简体   繁体   中英

MATLAB: Undefined function 'string' for input arguments of type 'char'?

A = 'Four score and seven years ago';
str = string(A);

With version R2016a I get error:

Undefined function 'string' for input arguments of type 'char'.

How can I have two strings array without using 'string':

str(1) = 'foo';
str(2) = 'bar';

?

I need to reference the two in file_id = fopen(str(i), 'wb');

You can define your strings into a cell array and access them in loop.

str = {'foo' 'bar'} ;
str{1}
str{2}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM