[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help me up with MATLAB, please!




On Wed, 2 Jul 1997, Vu Nguyen-Cong wrote:

> > >Could someone give me the answer of the following MATLAB code
> > >
> > >z = [
> > >	1	0	0
> > >	1	0	0
> > >	0	1	0
> > >	0	1	0
> > >	0	0	1
> > >	0	0	1
> > >];
> > >
> > >z(:, any(z)) = ???
> > >
> > >The output of OCTAVE is
> > >
> > >  1  1  1
> > >  1  1  1
> > >  0  0  0
> > >  0  0  0
> > >  0  0  0
> > >  0  0  0
> > >
> > >I don't know if it's correct because I do not have MATLAB here.
> > >
> > >Thanks in advance,
> > >Vu Nguyen-Cong
> > >ncv@ap.cc.affrc.go.jp
> > 
> > 
> > 
> >         z(:, any(z)) = ???
> > 
> >         What are you trying to do, Cong? matrix calculation or what?
> > 
> >         Tuan
> 
> Hello anh Tuan,
> 
> I'm trying to understand a MATLAB program for proportional odds model
> in statistics and port it to another language. My question is concerned
> with the data preprocessing step that I have not understood well. Therefore,
> I must track it. I believe that the answer should be z itself but I do
> not have MATLAB to test it.
> 
> Vu Nguyen-Cong
> 
> PS. Do you still want me to work with you on some projects?

Hi Nguyen-Cong,

The result of z(:,any(z)) is z as you expected.

Here is the meaning of function ANY of MATLAB:

 ANY 	True if any element of a vector is true.
 	For vectors, ANY(V) returns 1 if any of the elements of the
  	vector are non-zero. Otherwise it returns 0. For matrices,
  	ANY(X) operates on the columns of X, returning a row vector
  	of 1's and 0's. 

Hope this will help

Regards!

Nguyen Hoang Ha