HI all,
I tried to graph the some data using the following loop i'm new to matlab but i think this is almost right. The only thing is i got this error. Anyone have any ideas? Any help would be appreciated thanks!
fieldNames = fieldnames(MCR_full.MIB035.Reaches);
peakArray
peakArray = 0;
for k = 1 :3(fieldNames)
thisFieldName = fieldNames{k};
thisArray = MCR_full.MIB035.Reaches.(thisFieldName).kin;
x = thisArray(:, 1);
y = thisArray(:, 3);
peakArray{k} = findpeaks(y);
f=figure(k);
plot (peakArray{k});
title(['Peaks for ', thisFieldName]);
end
grid on;
Unable to perform assignment because brace indexing is not supported for
variables of this type.

 채택된 답변

Matt J
Matt J 2021년 10월 29일
편집: Matt J 2021년 10월 29일

0 개 추천

Instead of
peakArray = 0;
you need,
peakArray = cell(1,numel(fieldNames));

댓글 수: 4

Mackenzie Maher
Mackenzie Maher 2021년 10월 29일
Thank you!
Mackenzie Maher
Mackenzie Maher 2021년 10월 29일
So now it has this error
Error using fieldnames
Not enough input arguments.
peakArray = cell(1,numel(fieldNames));
and you should have
for k = 1 : numel(fieldNames)
Mackenzie Maher
Mackenzie Maher 2021년 10월 29일
Got it Thank you so much!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

질문:

2021년 10월 29일

댓글:

2021년 10월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by