Clear Filters
Clear Filters

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

2 views (last 30 days)
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 Comment
Walter Roberson
Walter Roberson on 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);

Sign in to comment.

Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!