how to save string values in matfile

2 次查看(过去 30 天)
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

采纳的回答

Jan
Jan 2013-8-20
编辑:Jan 2013-8-20
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'};
.
.
.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by