Exporting array

Hello guys, I have rather simple question: how can I save a matrix into file i.e. (.mat)?? I have matrix of 16*16 in my code and I want to save it into c:/'FileName'.mat
Cheers

Risposte (2)

Fangjun Jiang
Fangjun Jiang il 28 Giu 2011

0 voti

save FileName VariableName
Sean de Wolski
Sean de Wolski il 28 Giu 2011

0 voti

save('FileName.mat','yourmatrix')

3 Commenti

Mohamed mohamed
Mohamed mohamed il 28 Giu 2011
I already Tried that !
I am trying to do something like this:
Filename='FileName';
Data=ones(10,10)
OutputFile=['C:/File/' FileName '.mat']
A=Data(1:5,1:5);
save(OutputFile,A)
But is not not working !
Sean de Wolski
Sean de Wolski il 28 Giu 2011
save(OutputFile,'A')
Note the single quotation. Yes, I hate that subtle fact too.
Fangjun Jiang
Fangjun Jiang il 28 Giu 2011
Or, use command format
save OutputFile A

Accedi per commentare.

Categorie

Richiesto:

il 28 Giu 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by