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

New to MATLAB?

how to save string values in matfile

Asked by Elysi Cochin

Elysi Cochin (view profile)

on 20 Aug 2013
Accepted Answer by Jan

Jan (view profile)

how to save string values in matfile

Instead of these integer values,

    label(1,1:44) = 0;
    label(1,45:316) = 1;
    label(1,317:362) = 0;
    label(1,363:555) = 1;
    label(1,556:588) = 0;
    label(1,589:834) = 1;

i want to store as '0' instead of 0 and '1' instead of 1.

When i did as label(1,1:44) = {'0'};

i got error

??? The following error occurred converting from cell to double: Error using ==> double Conversion to double from cell is not possible.

How to do it. Please do reply

0 Comments

Elysi Cochin

Elysi Cochin (view profile)

Tags

Products

No products are associated with this question.

1 Answer

Answer by Jan

Jan (view profile)

on 20 Aug 2013
Edited by Jan

Jan (view profile)

on 20 Aug 2013
Accepted answer

If label is a matrix of doubles you are trying to mix types in a matrix using

 label(1,1:44) = {'0'};

Instead, create a new cell array

 label_str = cell( size(label) );

and then fill it:

 label_str(1,1:44) = {'0'};
 label_str(1,45:316} = {'1'};
 . 
 .
 .

1 Comment

Elysi Cochin

Elysi Cochin (view profile)

on 20 Aug 2013

thank you so much

Jan

Jan (view profile)

Contact us