Problems with plotting.

23 visualizzazioni (ultimi 30 giorni)
EC
EC il 11 Gen 2020
Commentato: EC il 28 Gen 2020
I cannot get functions such as hold on or grid on to properly work. I'm just trying to do a simple exercise where I type:
plot(1,1.5,'o')
hold on
plot(2,2,'*r')
axis([-1,2,0,3])
grid on
I tested this with the online edition and it works as it should, but I'm running into problems with my installed copy. Whenever I execute a line the plot pops up but nothing is saved. First line works fine, when the line 'plot on' is executed a blank plot pops up. When the third line is executed it only shows that plot, and does not include the first line plot. The axis line will show a blank plot with the correct axis scale. The 'grid on' will result in a blank plot with the grid showing, if I run another plot line afterward, the grid will not be showing anymore. I had 2018a installed, and then tried installing 2019b to see if that would fix the issue but still no luck. Not sure if it would make a difference but using education license.
  12 Commenti
dpb
dpb il 15 Gen 2020
Try
close all
plot(rand(10,1),'o-b')
hAx=gca; % retrieve current axes handle
%hold on % let's go lower level...
hAx.NextPlot='add'; % what hold on does; "off'--> 'replace'
plot(rand(10,1),'x-r')
Oh...maybe the hold function has somehow gotten corrupted...what does
which -all hold
return?
Or, before the above, one more check...try
close all
hAx=axes; % create a new axis, save handle
hAx.NextPlot % see initial state of hold
plot(rand(10,1),'o-b')
hold on
hAx.NextPlot % and afterwards
to see what hold actually did. Report on results.
EC
EC il 28 Gen 2020
Sorry for late reply, the class that uses Matlab didn't have any new assignments and had other classwork to finish. From the code:
'which -all hold'
I got:
'C:\Program Files\MATLAB\R2019b\toolbox\matlab\graphics\axis\hold.m'
Tried the other codes which resulted in plots and in the console:
'
ans =
'replace'
ans =
'add'
'
Thought I'd give some of the earlier assignments another shot sice it had been over a week since I tried anything and the plot fuction was working as it was supposed to. I'm not sure what changed, I haven't updated anything other than chrome, and did install acrobat DC, which I wouldn't think either should affect Matlab. Also, not sure if it will last as thought the teacher had fixed it before, but like that it is working for now.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Introduction to Installation and Licensing in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by