I am stuck I have a matrix with numbers and NaN's. I want
to delete the NaN's and reshape the matrix so i can plot it
against a similar matrix which has numbers in same
position.
14.8240 15.9172 17.0103 NaN NaN
15.3632 16.4563 17.5495 NaN NaN
NaN 16.9926 18.0858 20.9280 NaN
NaN NaN NaN 22.3190 23.4121
NaN NaN NaN 22.8581 23.9513
NaN NaN NaN NaN 24.4876
NaN NaN NaN NaN NaN
NaN NaN NaN NaN NaN
NaN NaN NaN NaN NaN
Why don't you use find to remove the rows where there are
no numbers any more to trim the matrix, then
b=isnan(a);
a(b)=0;
to replace the remaining NaNs with zeros?
Reshaping after that is a bit more tricky.
Does your matrix always look the same?
Daphne
"Ali Hussain" <hussaizj@aston.ac.uk> wrote in message
<g3vm9i$34o$1@fred.mathworks.com>...
> Hello,
>
> I am stuck I have a matrix with numbers and NaN's. I
want
> to delete the NaN's and reshape the matrix so i can plot
it
> against a similar matrix which has numbers in same
> position.
>
> 14.8240 15.9172 17.0103 NaN NaN
> 15.3632 16.4563 17.5495 NaN NaN
> NaN 16.9926 18.0858 20.9280 NaN
> NaN NaN NaN 22.3190 23.4121
> NaN NaN NaN 22.8581 23.9513
> NaN NaN NaN NaN 24.4876
> NaN NaN NaN NaN NaN
> NaN NaN NaN NaN NaN
> NaN NaN NaN NaN NaN
>
> Thanks
>
>
I would like to plot the data and Matlab plots a seperate
line for each column. If I put zero's the plot lines wil
keep returning to zero. Where I would like to plot a line
through these points(with out NaN and Zero's).
Thanks
"Daphne " <daphnew_too_nospam@yahoo.com> wrote in message
<g3vnoc$1is$1@fred.mathworks.com>...
>
> Why don't you use find to remove the rows where there are
> no numbers any more to trim the matrix, then
> b=isnan(a);
> a(b)=0;
> to replace the remaining NaNs with zeros?
> Reshaping after that is a bit more tricky.
> Does your matrix always look the same?
>
> Daphne
>
>
> "Ali Hussain" <hussaizj@aston.ac.uk> wrote in message
> <g3vm9i$34o$1@fred.mathworks.com>...
> > Hello,
> >
> > I am stuck I have a matrix with numbers and NaN's. I
> want
> > to delete the NaN's and reshape the matrix so i can
plot
> it
> > against a similar matrix which has numbers in same
> > position.
> >
> > 14.8240 15.9172 17.0103 NaN NaN
> > 15.3632 16.4563 17.5495 NaN NaN
> > NaN 16.9926 18.0858 20.9280 NaN
> > NaN NaN NaN 22.3190 23.4121
> > NaN NaN NaN 22.8581 23.9513
> > NaN NaN NaN NaN 24.4876
> > NaN NaN NaN NaN NaN
> > NaN NaN NaN NaN NaN
> > NaN NaN NaN NaN NaN
> >
> > Thanks
> >
> >
>
"Ali Hussain" <hussaizj@aston.ac.uk> wrote in message
<g3vpke$b85$1@fred.mathworks.com>...
> I would like to plot the data and Matlab plots a seperate
> line for each column. If I put zero's the plot lines wil
> keep returning to zero. Where I would like to plot a line
> through these points(with out NaN and Zero's).
Zeros are not necessary:
A(~isnan(A))
is a vector of the non-NaN elements of A.
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central.
Read the complete Disclaimer prior to use.