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

4 Ansichten (letzte 30 Tage)
Thao Linh Tran
Thao Linh Tran am 26 Mär. 2019
Kommentiert: Walter Roberson am 26 Mär. 2019
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 Kommentar
Walter Roberson
Walter Roberson am 26 Mär. 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);

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by