How to recode the strings() function?

I have a piece of Matlab code designed for Matlab 2016 and higher. I have Matlab 2015b, which does not have the strings() function.
I the code I'm trying to run, there is this piece of code which returns species_list as an array of strings:
[IC,sn,~] = xlsread('Initialize.xlsx','IC');
species_list = strings(length(sn),1);
[species_list{:}] = sn{:};
The call to strings() returns the error:
Attempt to execute SCRIPT strings as a function:
/home/apps/Mathworks/MATLAB/R2015b/toolbox/matlab/strfun/strings.m
Error in get_data_dictionary (line 55)
species_list = strings(length(sn),1);
How could I recode from scratch the strings() function? Or is there another workaround? Many thanks!

답변 (1개)

Star Strider
Star Strider 2021년 5월 24일

1 개 추천

The string data type is new to R2016b.
A possible workaround could be the cellstr function (introduced prior to R2006a).
Experiment to see if it works with the rest of your code.

카테고리

도움말 센터File Exchange에서 Characters and Strings에 대해 자세히 알아보기

질문:

2021년 5월 24일

답변:

2021년 5월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by