help-octave
[Top][All Lists]
Advanced

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

Re: How to create automatically the variable name


From: Mike Miller
Subject: Re: How to create automatically the variable name
Date: Sun, 24 Jun 2018 09:45:00 -0700
User-agent: Mutt/1.10.0 (2018-05-17)

On Sun, Jun 24, 2018 at 00:50:49 -0700, Leloup wrote:
> Hello,
>     I should like creating automatically the variable name. I tried :
>  >>for K = 1:3,name = ["A",num2str(K)],endfor
> name = A1
> name = A2
> name = A3
>  However that fails because I need to associate to each variable A1, A2 to
> data. For example A1 = 1, A2 = 2...
> I tried:
> >> for K = 1:10,["A",num2str(K)] = K,endfor

You might find the 'assignin' function useful.

  https://octave.org/doc/interpreter/Evaluation-in-a-Different-Context.html

-- 
mike

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]