How to include a vertical line at the sample when instant of landing

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

Sign in to comment.

Answers (2)

Les Beckham
Les Beckham on 17 Apr 2020
Edited: Les Beckham on 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.

Vanessa Arp
Vanessa Arp on 17 Apr 2020
Thank you all, i truly appreciate it..
I figure out the issues.. now Im on section 9 and 10
the errors appeared
Error using matlab.graphics.axis.Axes/get
Invalid or deleted object.
Error in VMArpAssignment6 (line 67)
line([sampB4TakeOff sampB4TakeOff],get(hax,'YLim'),'Color',[1 0 0])
Unrecognized function or variable 'dt'.
Error in VMArpAssignment6 (line 78)
cropTime = cropSample*dt; %convert samples to time
Not sure what i did wrong..
  2 Comments
Les Beckham
Les Beckham on 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.

Sign in to comment.

Categories

Find more on Graphics Object Programming 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!