How to save Char from Structure into Array MATLAB
Mostrar comentarios más antiguos
Hello, I hope you are doing well. I have the following Dataset which is basically in Structure form.
I want to save the ClassName array of two rows and one column using for loop
I have tried the following code But the codes does not work. Can any body help me with that
load ('Dataset.mat')
for i =1:length(Dataset)
ClassificationResult=Dataset(i).ClassName
OverallResult(i)=ClassificationResult;
end
Respuestas (1)
S = load('Dataset.mat');
D = S.Dataset
T = string({D.ClassName})
4 comentarios
Dyuman Joshi
el 5 de Abr. de 2023
Ah, I couldn't think of storing them in a cell array
SH
el 5 de Abr. de 2023
SH
el 5 de Abr. de 2023
"Dont want to convert it into string. Use char and save it into array using loop"
S = load('Dataset.mat');
D = S.Dataset
C = char(D.ClassName)
A string array is better. A loop is not required.
Categorías
Más información sobre Matrices and Arrays en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!