Plotting from a .mat file takes too long, what to do?

1 view (last 30 days)
Hi all,
I have a small data to be plotted but having problem. Data is read from xlsx file and I saved it to mat file. attached file has 2 variables, each 801 long.
But when plotting, figure windows opens in background with no plot, also i cant bring it to front by clicking. It must be trivial but i cant see it. what can be the problem?
Thanks
Utku

Accepted Answer

Star Strider
Star Strider on 18 Jan 2016
I would have to see your code to see what the problem could be.
It plots for me without problems:
D = load('utku g data.mat');
x = D.x;
y = D.y;
figure(1)
plot(x, y)
grid
  2 Comments
utku g
utku g on 18 Jan 2016
Hey, I was just using,
plot(x, y)
without figure command. After asking the question, I have closed MATLAB, when reopened it ran successfully.
But I wonder why did this happen? Can it be because I read 50 more variables other than these two? It seemed working correctly though.
Thanks Star Strider.
Star Strider
Star Strider on 18 Jan 2016
My pleasure.
The figure call is not necessary, but since MATLAB will plot in the available figure window, specifying a new one each time will allow you to plot several figures in different figure windows without overplotting them (unless you want to).
For instance, if you plot:
figure(1)
plot(x1, y1)
plot(x2, y2)
the second plot call replaces the first, so you will only see (x2,y2) plotted. If you specify different figures:
figure(1)
plot(x1, y1)
figure(2)
plot(x2, y2)
each will plot in its own figure window.

Sign in to comment.

More Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!