Removing Struct from Cell Array

조회 수: 5 (최근 30일)
Chris Dan
Chris Dan 2020년 6월 14일
댓글: Ameer Hamza 2020년 6월 14일
Hello,
I use the following code to load files from the folder
[files,pathToFiles] = uigetfile('*.mat',...
'Select One or More Files', ...
'MultiSelect', 'on');
out = {};
if ~iscell(files)
out{1} = load(fullfile(pathToFiles, files));
else
for k = 1:length(files)
out{k} = load(fullfile(pathToFiles, files{k}));
end
end
I have this one file, It is a struct with three fields stored as a cell array, it looks like this
Is there any way, I can remove the 1x1 struct and make the file directly a cell array, like a 3x1 cell array, remove the struct part.
I have attached the file as well with the question.
Does anybody know how to do it?

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 6월 14일
See struct2cell()
out = struct2cell(out{1});
  댓글 수: 2
Chris Dan
Chris Dan 2020년 6월 14일
thanks
Ameer Hamza
Ameer Hamza 2020년 6월 14일
I am glad to be of help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by