Accessing data from a struct cell

10 ビュー (過去 30 日間)
Daniela Valdez
Daniela Valdez 2021 年 1 月 20 日
編集済み: Stephen23 2021 年 1 月 20 日
Hi! I'm working on an SVM Classifier that will transmit information. The SVM Classifier is ready, now I need finish he transmittion section of my project, for that I need to access a data cell from a struct and plot that. I'll add pictures.
That's my struct array and I need to acces the cell that's selected. When I access it, I get the following table, which is the one I need to plot.
I need to plot all 12 columns in separate graphs, since each one corresponds to a different ECG lead.
Appreciate it

回答 (1 件)

Stephen23
Stephen23 2021 年 1 月 20 日
編集済み: Stephen23 2021 年 1 月 20 日
Assuming that your structure is named S, you can loop over it like this:
for k = 1:numel(S)
plot(S(k).data) % default plots the columns of the input array
fnm = sprintf('plot_%d.png',k);
saveas(fgh,fnm)
end

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by