How to plot a structure with multiple fields

 採用された回答

Jan
Jan 2021 年 3 月 11 日
編集済み: Jan 2021 年 3 月 11 日

0 投票

FigH = figure;
AxesH = axes(FigH, 'NextPlot', 'add');
for k = 1:numel(rgn2)
data = rgn2(k).PixelList;
plot(data(:, 1), data(:, 2)); % Or how you plot one of these values
end

4 件のコメント

Eberechi ICHI
Eberechi ICHI 2021 年 3 月 11 日
Thanks @Jan
I adapted your code but was only getting kind of the last field being ploted. see my modified code below for any further comments. The points are meant to appear all on the image (101 plots of patches).
for k = 1:numel(rgn2)
imshow(StichedM_PRNB_2);
hold on;
data = rgn2(k).PixelList;
plot(data(:, 1), data(:, 2), 'w*', 'LineWidth', 2, 'MarkerSize', 1);
title('Class 2 removal on PRNB', 'FontSize', 12);
end
Eberechi ICHI
Eberechi ICHI 2021 年 3 月 11 日
Please i ned assistacne on how to get the all fields plotted in the loop. Thanks
Jan
Jan 2021 年 3 月 11 日
Move these lines out of the loop:
imshow(StichedM_PRNB_2);
hold on;
title('Class 2 removal on PRNB', 'FontSize', 12);
Eberechi ICHI
Eberechi ICHI 2021 年 3 月 11 日
Thanks @Jan. This worked perfectly...
subplot(2,2,4)
imshow(StichedM_PRNB_2);
hold on;
for k = 1:numel(rgn2)
data = rgn2(k).PixelList;
plot(data(:, 1), data(:, 2), 'w*', 'LineWidth', 2, 'MarkerSize', 1);
end
title('Class 2 removal on PRNB', 'FontSize', 12);

サインインしてコメントする。

その他の回答 (0 件)

製品

リリース

R2020a

質問済み:

2021 年 3 月 11 日

コメント済み:

2021 年 3 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by