From: Nilesh Joshi on
I have ma matrix
a= [1 2 3 4 5 6 6 7
3 2 1 4 6 7 6 7]
if I enter the value 4 then program should should generate two matrix having element from above matrix. like b=a(:,even column) and c =a(:,odd column)

if I enter if I enter the value 2 then program should should generate 4 matrix having element from above matrix. like b1=b(:,even column) and b2 =b(:,odd column)
c1=c(:,even column) and c2 =c(:,odd column)....where b and c are derived form method first......how can I apply this method.
From: Walter Roberson on
Nilesh Joshi wrote:
> I have ma matrix a= [1 2 3 4 5 6 6 7
> 3 2 1 4 6 7 6 7]
> if I enter the value 4 then program should should generate two matrix
> having element from above matrix. like b=a(:,even column) and c
> =a(:,odd column)

function [lo, l0] = l(o)
lo = o(:,1:2:end);
l0 = o(:,2:2:end);
end

[b, c] = l(a);
[b1, b2] = l(b);
[c1, c2] = l(c);
From: Nilesh Joshi on
I am scared....its not working for me.....will it work if we increase the number of column to 2^n......ex if no of column is 16 then I can enter the value 2 or 4 or 8. how to set the variable.
From: Nilesh Joshi on
Walter Roberson <roberson(a)hushmail.com> wrote in message <i2nk0v$1qd$1(a)canopus.cc.umanitoba.ca>...
> Nilesh Joshi wrote:
> > I have ma matrix a= [1 2 3 4 5 6 6 7
> > 3 2 1 4 6 7 6 7]
> > if I enter the value 4 then program should should generate two matrix
> > having element from above matrix. like b=a(:,even column) and c
> > =a(:,odd column)
>
> function [lo, l0] = l(o)
> lo = o(:,1:2:end);
> l0 = o(:,2:2:end);
> end
>
> [b, c] = l(a);
> [b1, b2] = l(b);
> [c1, c2] = l(c);

I dont know why I got error in this program.....if I make the length of the column to power of 2 than I can enter more other value also....how can I handle this problem