Why did I get this error ?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mackenzie Maher
am 29 Okt. 2021
Kommentiert: Mackenzie Maher
am 29 Okt. 2021
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.
0 Kommentare
Akzeptierte Antwort
Matt J
am 29 Okt. 2021
Bearbeitet: Matt J
am 29 Okt. 2021
Instead of
peakArray = 0;
you need,
peakArray = cell(1,numel(fieldNames));
4 Kommentare
Walter Roberson
am 29 Okt. 2021
peakArray = cell(1,numel(fieldNames));
and you should have
for k = 1 : numel(fieldNames)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!