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

dpb
dpb 2020년 1월 11일
편집: dpb 2020년 1월 11일
I suppose you've already tried the expedients of clear all and restarting Matlab...
Have you had a local installation of any earlier release that doesn't show the symptoms on the same machine/OS?
Is the institution education license or personal on a given machine? What OS?
Might see what happens if change the graphics renderer to 'software' and see if perhaps the graphics card is the culprit, maybe. Updating the video drivers to latest release from the vendor is always a thing to try...
EC
EC 2020년 1월 11일
편집: EC 2020년 1월 11일
Yeah I tried clear all, restating Matlab, then restarting machine, and finally installing newer version.
I'm using Windows 10. I had used the same computer and version 2018b last year for a class and don't recall any problems with the truss problems, then when I started it for a new class this year started having the described problems with original 2018b installation I had.
I'm guessing it is the educational edition, as the license is provided through the school, for Windows.
I did upgrade my graphics driver about a month ago but not sure if that would be the cause of the problem, the plot shows, it just doesn't save any information from the lines above. I can write everything on one line, each command separated by ';' and it will show what I need, but writing line by line doesn't work on my installed copy. The online works as I think it should, so definitely think there is something wrong with my installation, maybe a setting got changed somehow but not sure what to look for.
dpb
dpb 2020년 1월 12일
Reread the text...I'm presuming it's just a typo but you say "...when the line 'plot on' is executed a blank plot pops up." That's what I'd expect with an error on syntax for that command if that's what actually do try to execute. The code snippet includes what I think is intended hold on, but just in case make sure you didn't/aren't mistyping what you really intended.
If it isn't something like that, is this a personal or institutional machine you're running on? It sounds like may need someone from the IT group who handles the institutional license to contact installation support if they can't solve it. If it's your machine, I'm not sure how that works for support...TMW does support installation issues gratis; you can try that route if IT can't/won't help.
EC
EC 2020년 1월 12일
Whoops that was a mind slip in the paragraph, I should have put 'hold on' not 'plot on.' When I was typing it in the comand window I wasn't getting any syntax error so I know I wasn't just constantly typing the wrong thing when trying to get it to work, and I did get it to work fine no problems with the online edition.
The machine I'm trying to get it to work on is a personal computer. I'll try asking the professor if he has come across this the next time I have class. I was able to finish the homework assignment with the online edition but would prefer to get my installd copy working to use it for next assignment.
Sindar
Sindar 2020년 1월 12일
there's a chance you have some weird startup behavior set. try
edit startup
and see if there's anything in there
EC
EC 2020년 1월 14일
I tried the edit startup, and the program said there wasn't one, and asked if I wanted to create one. I also asked my professor and he tried 'close all' then he was able to plot a point and turn on the grid and the point was still plotted, so I thought it was solved, but after trying it myself, even repasting exactly what he typed, I could not get it to work again. Then I showed him a second time that it wasn't working, he couldn't get it to successfully plot a point and have the grid on, let alone having two points plotted. Not sure what is going on with it, espeacially since it worked for one instance.
dpb
dpb 2020년 1월 14일
편집: dpb 2020년 1월 14일
That really does sound like something funky going on in the video drivers/chipset arena...
What happens with
clear all
plot(rand(10,1))
followed then by
close all
plot(rand(10,1),'o-b')
hold on
plot(rand(10,1),'x-r')
?
I presume you get no error messages from Matlab, just not the expected plot results?
EC
EC 2020년 1월 14일
Had an invalid expression with second code, then saw needed a comma between ...1)'o.., after that worked fine, no other errors. I can get the second to display correctly if everything is put in at once, either on one line or copy and paste, but no dice if I try line by line.
dpb
dpb 2020년 1월 14일
Oh, sorry for the typo...good catch on missing comma.
You mean simply typing one instruction line at a time in the command window does not result in the same figure?
In that case, if so, never heard of such a thing before, but makes sound as though something is wrong with the keyboard buffer/input...
I gather this is a laptop or other portable device, not a desktop? What is the environment?
EC
EC 2020년 1월 14일
I'm using a laptop running windows 10. If I run the "plot(rand(10,1),'o-b')" it will plot it no problem, if the next line I type "hold on" the plot shows up blank, so then when I type "plot(rand(10,1),'x-r')" it shows that plot. I was trying to avoid it but maybe I need to do something with my drivers, I did update my video card driver from when it was working fine 2 semesters ago to now.
dpb
dpb 2020년 1월 15일
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 2020년 1월 28일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

질문:

EC
2020년 1월 11일

댓글:

EC
2020년 1월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by