|
Hi Matlabers!
I need some help for a little problem.
I am using save function to save a matrix with a structure:
this is my matrix (for example):
matrix_example.a=12.2;
matrix_example.b='Hi!';
Now I want to save it. if I use matlab command syntax, it is:
save myexample.mat -struct matrix_example
That works fine. The thing is that I want to save matrix_example under a file name that I compose like that:
filename='myfilename.mat';
so if I write:
save filename -struct matrix_example
it works, matlab save my matrix, but under the name filename.mat, and not mysfilename.mat!!!!!!!
ie it does not go inside filename variable and takes the string inside (myfilename.mat) !!!!
how can i solve this problem?!
using function format => save (filename, ' -struct', matrix_example) ?
I get this error:
??? Error using ==> save
The argument to -STRUCT must be the name of a scalar structure variable.
Thanks in advance for your help!
|