[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Naming variables using existing variables....
From: |
Christoph Ellenberger |
Subject: |
Re: Naming variables using existing variables.... |
Date: |
Mon, 28 Feb 2011 16:51:41 +0100 |
Hi,
I know it is not the most efficient code ... but something like
for i=1:n
eval(cstrcat("A_",num2str(i)),"= rand("num2str(i)","num2str(i)");");
end
would probably work.
Greetings
Christoph
PS. I didn't test so there might be some typos....
-------- Original-Nachricht --------
> Datum: Mon, 28 Feb 2011 07:41:45 -0800 (PST)
> Von: bleagos <address@hidden>
> An: address@hidden
> Betreff: Re: Naming variables using existing variables....
> Hey Laurent,
>
> Thanks for replying so quick. The only problem with this is that I want my
> input to be matrices of different size depending on the local variable. So
> something like this:
>
> for i=1:n
> A_i = rand(i,i);
> end
>
> I have been trying do something like:
>
> for i=1:n
> strcat("A",num2str(i)) = rand(i,i);
> end
>
> But I have been getting some weird results because octave turns the
> variable
> strcat into a matrix...
>
> Thanks
>
>
>
> --
> View this message in context:
> http://octave.1599824.n4.nabble.com/Naming-variables-using-existing-variables-tp3328092p3328125.html
> Sent from the Octave - General mailing list archive at Nabble.com.
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave
--
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
Re: Solved: Naming variables using existing variables...., bleagos, 2011/02/28