[Scilab-users] save : save a list of variable don't work

Antoine Monmayrant antoine.monmayrant at laas.fr
Tue Oct 14 15:13:56 CEST 2014


On 10/14/2014 02:50 PM, Quentin Mazué wrote:
> hello,
>
>
> Antoine Monmayrant wrote
>> This is what you want to do I think:
>>
>> save(pwd()+"\saveInSodFormat.sod",'a','b','c','d');
> Yes it is. However in my script, the variable var2save could contain 1,2, or
> 100 variables. The number of variables is never the same. So I have another
> script that fill the variable var2save with the name of the variable I want
> to save and then I want to save this variables with their own values. (here
> variables a,b,c and d are only an example)
>
> If you use the function loadmatfile("saveInMatFormat.mat"), you will load
> a=1;
> b=2;
> c=[1;2;3;4;8;9;6];
> d = [7];
> *It is what I want.*
>
> However if you use the function load("saveInSodFormat.sod"), you will load
> var2save  = !a  b  c  d  !
> *I don't want this*
>
>
> Summary :
> 2 different save function lead to 2 different save data although it was
> expected to be the same.

OK, you are only half-wrong!
Here it is: you have misused both save and savematfile by using a 
calling sequence that does not make sense (this is where you are wrong).
There is no mention in the help page of savematfile or save of the usage 
of a 1D vector of names of variables to save (what you have done).
The result you obtained with save is as expected: as explained in the 
help page, it uses the deprecated syntax and consider your 1D vector as 
the variable to save.
However, savematfile should not have worked and that's where you are 
right: there is a bug.
The bug is either in the help page of savematfile that omits the calling 
convention you have used or in savematfile that should have complained 
about you using a calling sequence that does not make sense.

Cheers,

Antoine

>
> Regards
> Quentin Mazué
>
>
>
> --
> View this message in context: http://mailinglists.scilab.org/save-save-a-list-of-variable-don-t-work-tp4031334p4031336.html
> Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>




More information about the users mailing list