Azzera filtri
Azzera filtri

How to reload, plot and edit a polygon created by drawpolygon

1 visualizzazione (ultimi 30 giorni)
Hi everybody,
I am trying to reload, plot and edit the polygon that I created by drawpolygon and saved in ".mat" file. The code is as below
% hTWN = drawpolygon('FaceAlpha',0); hTWN.Color='green'; hTWN.LineWidth=1; save ('Polygon_TWN.mat','hTWN');
load Polygon_TWN.mat;
figure;
plot(hTWN);
However, I got the folowing error
>> Untitled5
Error using plot
Not enough input arguments.
Error in Untitled5 (line 4)
plot(hTWN);
Could you please help to point out how to solve this. Much appreciated!
  1 Commento
Walter Roberson
Walter Roberson il 26 Mar 2019
In the code, before the load, add
hTWN = [];
Otherwise in current MATLAB, the parser would assume that the load is not going to "poof" variables into existence.
You could also use
TWN_struct = load('Polygon_TWN.mat');
figure;
plot(TWN_struct.hTWN);

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Prodotti


Release

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by