MATLAB Answers

0

<1x1 struct> unsupported class

Asked by Konstantina on 22 Mar 2019
Latest activity Commented on by Konstantina on 25 Mar 2019
Hello!
I am dealing with the following:
I have a script, which I run and at the end of the script all the variables are written in a .mat file using the command
MatFilename = [folder,92,system_name];
save(MatFilename);
while an already existing .m file with the same variables is being updated using the command
mFilename=[folder,92,system_name,'.m'];
matlab.io.saveVariablesToScript(mFilename,'SaveMode','update','MaximumTextWidth',200, 'MaximumArraySize',10000);
Now, in the original script I have the following:
OL_TTable=cell2struct(TT,Tstrings,2);
which in the workspace gives something like this:
OL_TTable =
struct with fields:
Tstrings1: ["41" "Wavelength" "RS" "dRS" "qRS" "RP" "dRP" "qRP"]
Tstrings2: ["82" "Wavelength" "RS" "dRS" "qRS"]
Tstrings3: ["41" "Wavelength" "RS" "dRS" "qRS" "RP" "dRP" "qRP"]
Tstrings4: ["40" "Wavelength" "RS" "dRS" "qRS" "RP" "dRP" "qRP"]
Tstrings5: ["39" "Wavelength" "RS" "dRS" "qRS" "RP" "dRP" "qRP"]
Tstrings6: ["38" "Wavelength" "RS" "dRS" "qRS" "RP" "dRP" "qRP"]
Tstrings7: ["37" "Wavelength" "RS" "dRS" "qRS" "RP" "dRP" "qRP"]
In the output .m file, instead of that, I get the following:
OL_TTable = saveVarsMat.OL_TTable; % <1x1 struct> unsupported class at OL_TTable.Tstrings1
and at the same time I get this warning on my workspace:
Warning: The variables that could not be saved into MATLAB script are saved
into MAT-file 'D:\Mulprod\MulProd723\MulProd7231\newOL_COM_KK\Test01.mat'.
Does anyone know how I can write the structure OL_TTable directly on the output m.file?
Thanks in advance for your help!
Konstantina

  0 Comments

Sign in to comment.

1 Answer

Answer by Walter Roberson
on 22 Mar 2019
 Accepted Answer

Class string is considered a MATLAB object, it appears.
You might have to convert to cell array of character vector.

  2 Comments

Thanks for your feedback! I will have a look and see if that solves the problem.
Walter Roberson, that worked fine! Thanks a lot!

Sign in to comment.