Hello,
I am stuck..I have 3 large matrices x,y,z. I'm trying to
set all the values less than 5 to zero(zeros) or NAN and
the corresponding cells in the y and z matrix.
Is this possible? I have used the below which is not
working.
"Ali Hussain" <hussaizj@aston.ac.uk> wrote in message
<g3qif2$3m1$1@fred.mathworks.com>...
> Hello,
> I am stuck..I have 3 large matrices x,y,z. I'm trying to
> set all the values less than 5 to zero(zeros) or NAN and
> the corresponding cells in the y and z matrix.
>
> Is this possible? I have used the below which is not
> working.
>
> a=find (x<5)
> x = ZEROS(:,o)
>
> Thanks
>Hello,
>I am stuck..I have 3 large matrices x,y,z. I'm trying to
>set all the values less than 5 to zero(zeros) or NAN and
>the corresponding cells in the y and z matrix.
tpl@eng.cam.ac.uk (Tim Love) wrote in message
<g3qj4u$3ug$1@gemini.csx.cam.ac.uk>...
> "Ali Hussain" <hussaizj@aston.ac.uk> writes:
>
> >Hello,
> >I am stuck..I have 3 large matrices x,y,z. I'm trying to
> >set all the values less than 5 to zero(zeros) or NAN and
> >the corresponding cells in the y and z matrix.
>
> >a=find (x<5)
> Then do
> x(a)=0;
> y(a)=0;
> z(a)=0;
I have done that with my matrix. When I use the surface
plot it plots the zero values too. What i basically want to
do is to get rid of those numbers so it doesnt show in the
plot at all. So I have tried to use NAN but how would I
set that for the same range of values as above
"Ali Hussain" <hussaizj@aston.ac.uk> wrote in message
<g3qjtt$f4v$1@fred.mathworks.com>...
> tpl@eng.cam.ac.uk (Tim Love) wrote in message
> <g3qj4u$3ug$1@gemini.csx.cam.ac.uk>...
> > "Ali Hussain" <hussaizj@aston.ac.uk> writes:
> >
> > >Hello,
> > >I am stuck..I have 3 large matrices x,y,z. I'm trying to
> > >set all the values less than 5 to zero(zeros) or NAN and
> > >the corresponding cells in the y and z matrix.
> >
> > >a=find (x<5)
> > Then do
> > x(a)=0;
> > y(a)=0;
> > z(a)=0;
>
>
> I have done that with my matrix. When I use the surface
> plot it plots the zero values too. What i basically want to
> do is to get rid of those numbers so it doesnt show in the
> plot at all. So I have tried to use NAN but how would I
> set that for the same range of values as above
No need to use find, use logical indexing. Secondly, you can
set these elements to whatever value you want, including NaNs
An example:
x = [6 2 7 8 3 9]
y = [2 8 4 8 9 2]
a = x < 5 ;
x(a) = 0
y(a) = NaN
hth
Jos
Tags for this Thread
Add a New Tag:
Separated by commas
Ex.: root locus, bode
What are tags?
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.
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.