Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

condition check from matfile

Asked by Elysi Cochin on 2 Jan 2013

i have wanted to store 'value' and 'text' in a matfile....

value=[1; 2; 3; 4];

text=['J for Java';'M for Matlab';'C for cobol';'F for FORTRAN'];

when i try to save them in one matfile error is coming... i tried like this

save MatFilename value text

i wanted to save these values in a matfile... then i have a variable.... if the variables value is 3, i need to check whether that value is in the matfile and if it is in 'value' i need to display the third string from the 'text'

1 Comment

Azzi Abdelmalek on 2 Jan 2013

The problem is in your text variable, you can't use vertical concatenation with string with different sizes

Elysi Cochin

Tags

Products

No products are associated with this question.

2 Answers

Answer by TAB on 2 Jan 2013
Accepted answer

Use,

save('Filename.mat','value','text')

0 Comments

TAB
Answer by Walter Roberson on 2 Jan 2013
text=['J for Java';'M for Matlab';'C for cobol';'F for FORTRAN'];

would not be valid. It attempts to create a character array with different number of characters per row. Use {} instead of []

1 Comment

Elysi Cochin on 2 Jan 2013

thank u all...

Walter Roberson

Contact us