Is there a workaround to avoid printing NaN generated due to dtmc when using graphplot?

1 view (last 30 days)
I understand that MATLAB normalizes the transition matrix so that all rows sum to 1. That is, MATLAB computes a right-stochastic matrix from the matrix of observed transitions. Consequently, if I have a transition matrix for HMM that has an entire row 0,0 it is converted NaNs.
Technically, that does not cause the problem until I use graphplot and want to display the values of Edges (below image).
My transition matrix is sth like this (first column and last row are entirely 0). This is because the first column represents the states that transitions to the initial state, which is none, and the last row is entirely zero cause there's no transition after the final state.
I am basically looking for ways to workaround the hide or don't even show the NaNs in the first place in the graphplot.
I thought of removing the first column and the last rown and using that as a transition matrix but that makes the transition matrix asymetric (first column state and first row state won't be the same) and I cannot work with that.
I really appreciate any kind of guidance.

Accepted Answer

Rajani Mishra
Rajani Mishra on 13 Mar 2020
graphplot function does not have a support for not showing NaN values. Use can use plot function instead as graphplot is like plot function. In plot function you can interpolate to fill missing values.
You can refer to this link to learn about how to work around with NaN values in plot function :

More Answers (0)


Find more on Sparse Matrices in Help Center and File Exchange




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by