help-octave
[Top][All Lists]
Advanced

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

Re: load function


From: Brett Green
Subject: Re: load function
Date: Sat, 21 Dec 2019 08:20:53 -0800


On Sat, Dec 21, 2019, 2:01 AM Mono Brezel <address@hidden> wrote:
Hi Taquito,


I guess you need to define your variable as string and then just load it.


a = '200';
A =load(a);


I am currently not at my desk, give it a try...hope it works.


taquito <address@hidden> schrieb am Sa., 21. Dez. 2019, 13:56:
Hi! I'm trying to load a file called '200'. If I write A=load('200'), the
file is loaded without problems.

If define 
a=200;
A=load('a');

it doesn't work. This messagge appear: error: load: unable to find file a.

How can I solve it? Thanks!



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Mono is right, the argument you gave was the character "a", not the value assigned it as a variable. You can convert numbers to string using "num2str". For example:

a=200;
A=load(num2str(a));

reply via email to

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