How to include a vertical line at the sample when instant of landing
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have been working on section 8 for hours and days-- struggle to solve this before I can move unto section 9.. Can one of you help me out?
The error came on----Error using matlab.graphics.axis.Axes/get
Invalid or deleted object.
Error in VMArpAssignment6 (line 54)
line([sampB4Landing sampB4Landing],get(hax,'YLim'),'Color',[1 0 0])
I am not sure what did I do wrong....
2 Kommentare
Walter Roberson
am 17 Apr. 2020
while vGRF(sampB4TakeOff)>1;
sampB4TakeOff = sampB4Landing + 1;
end
That is an infinite loop because the right hand side does not vary as the loop executes. The right hand side should probably refer to SampB4TakeOff.
You should consider using find(vGRF>1,1)
Antworten (2)
Les Beckham
am 17 Apr. 2020
Bearbeitet: Les Beckham
am 17 Apr. 2020
When I run your code, I don't get the error you cite on line 54. That seems to work fine. The only issue I found was when determining the sample number for the takeoff point.
It appears that you have one of the most common errors in software development. This is the copy/paste issue where you copy and paste a section of code that does almost what you need to do somewhere else but don't quite make all of the changes you need to make to do something slightly different.
Look at the while loop starting at line 62. Is it actually doing anything different on each pass through the loop? Will sampB4Takeoff change?
I suggest that you set a breakpoint at line 62 (see here for documentation on using the debugger: https://www.mathworks.com/help/matlab/matlab_prog/debugging-process-and-features.html) and just step through the loop a few times and look at the value of the variables that you are using in the loop (you can just hover your mouse over a variable to see the value when stopped in the debugger). I think you will realize what you have done wrong and will be able to fix it.
Good luck.
0 Kommentare
Vanessa Arp
am 17 Apr. 2020
2 Kommentare
Les Beckham
am 17 Apr. 2020
The second error message you show is pretty clear. You are trying to use the variable 'dt' but you have not assigned a value to it.
When I run your revised code I don't get the first error you show, only the second one, which should be really easy to fix.
Siehe auch
Kategorien
Mehr zu Graphics Object Programming finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!