From: Shafi on
I am new MATLAB user with very limited programming background. However, I am learning by doing a specific problem. I am stuck a problem related to matrix.

Problem definition:

I have n number of column matrix (mx1). I want to combine them in single matrix(mxn). If the value of n is fixed then I can handle. But n will change for each iteration based on other factors.

I think there should be some way to do that.

I will be very grateful if someone who is expert in MATLAB can help me.

Thanks a lot
Regards
Shafi
From: TideMan on
On May 19, 11:36 am, "Shafi " <ait...(a)yahoo.com> wrote:
> I am new MATLAB user with very limited programming background. However, I am learning by doing a specific problem. I am stuck a problem related to matrix.
>
> Problem definition:
>
> I have n number of column matrix (mx1). I want to combine them in single matrix(mxn). If the value of n is fixed  then I can handle. But n will change for each iteration based on other factors.
>
> I think there should be some way to do that.
>
> I will be very grateful if someone who is expert in MATLAB can help me.
>
> Thanks a lot
> Regards
> Shafi

If n is fixed, how do you handle it?
It should be only slightly different if n changes, but it depends how
you are doing it.
From: Shafi on
For example, if I have three matrix say A, B, C then
my combined matrix, D=[A B C]. That means I need to define them.

But if become say 500, then manually doing is very difficult.

I want to do that by programming. I hope you got my problem.

Thanks and regards

Shafi

TideMan <mulgor(a)gmail.com> wrote in message <d2248abd-03ab-41a0-b20a-cdfcaf3cc3c3(a)g5g2000pre.googlegroups.com>...
> On May 19, 11:36 am, "Shafi " <ait...(a)yahoo.com> wrote:
> > I am new MATLAB user with very limited programming background. However, I am learning by doing a specific problem. I am stuck a problem related to matrix.
> >
> > Problem definition:
> >
> > I have n number of column matrix (mx1). I want to combine them in single matrix(mxn). If the value of n is fixed  then I can handle. But n will change for each iteration based on other factors.
> >
> > I think there should be some way to do that.
> >
> > I will be very grateful if someone who is expert in MATLAB can help me.
> >
> > Thanks a lot
> > Regards
> > Shafi
>
> If n is fixed, how do you handle it?
> It should be only slightly different if n changes, but it depends how
> you are doing it.
From: ImageAnalyst on
If all the column vectors have different names (e.g. m1, m2, m3,
m4, ... up to m500), you're kind of stuck doing it manually, unless
you want to try creating commands with sprintf and using eval to
string them together. Is there any pattern to the variable names,
like I showed above, such that you could use sprintf() to create the
variable names, and use sprintf again to create the commands for use
by eval()?
From: Shafi on
Thanks for your suggestion. Actually, I have used eval function to generate the name of the all matrix (m1,m2... m500). Please see below part of the code.

%%%%%%%%%%%%%%%%%%%%%
for i=1:500;

[mF] = mn + std.*randn(40,1); % creating a matrix of Multiplying facto(mF)
eval(['mmF' num2str(i) ' = mF'])% Storing each mF to differnt Matric name

end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

However, I did not get your second point. Could you please explain bit more?

Thanks and regards
Shafi


ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <bc6e419e-d1d1-46e2-afaf-ec10e6cb077b(a)c11g2000vbe.googlegroups.com>...
> If all the column vectors have different names (e.g. m1, m2, m3,
> m4, ... up to m500), you're kind of stuck doing it manually, unless
> you want to try creating commands with sprintf and using eval to
> string them together. Is there any pattern to the variable names,
> like I showed above, such that you could use sprintf() to create the
> variable names, and use sprintf again to create the commands for use
> by eval()?