Mask the matrix
Xin Dong
xdong at cse.unl.edu
Tue May 12 09:54:53 CDT 2009
It works. Thanks a lot!
On Tue, May 12, 2009 at 9:48 AM, James Sherman Jr. <shermanj at umd.edu> wrote:
> I'd so something like:
>
> c = all(a~=0,1);
> d = a([c;c]);
> b = reshape(d, 2, []);
>
> I think this will do what you want.
>
>
> On Tue, May 12, 2009 at 10:35 AM, Xin Dong <xdong at cse.unl.edu> wrote:
>
>> Hi,
>>
>> I have a program that generates a two row matrix with zero elements. I
>> wanna extract out the columns with elements in both rows are non-zero. For
>> example, if the matrix is
>> a = [ 1 0 2 3 4; 2 1 0 0 4],
>> I wanna get
>> b = [1 4; 2 4].
>> How can I use octave to do this?
>>
>> Thanks,
>> Xin
>>
>> _______________________________________________
>> Help-octave mailing list
>> Help-octave at octave.org
>> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www-old.cae.wisc.edu/pipermail/help-octave/attachments/20090512/11668a45/attachment.html
More information about the Help-octave
mailing list