Using F1 for help, gives help for wrong function
3 views (last 30 days)
Show older comments
Consider this code snippet:
plot(x, y1); % 2D line plot
hold on;
plot(x, y2); % 2D line plot
plot(p); % polyshape plot
When I click in the first "plot" above and press F1, a help window appears with the documentation for the 2D line plot function. That's great.
However, when I click in the third instance of "plot" and press F1, the same documentation appears. That's a problem since this function is the polyshape plot function, not the 2D line plot function. Seems to me the MATLAB IDE should have enough context to figure out which documentation to open... or am I missing something here?
0 Comments
Answers (1)
Steven Lord
on 7 Oct 2021
Does the variable p exist in the workspace when you ask for help? It's not sufficient that the code to create that variable as a polyspace exists in your file. You don't want MATLAB to run your code when you press F1 to determine which overload's documentation to display. [What if hold or the first calls to plot assigned a new value to p, meaning when that line gets executed or won't do what static analysis of the code said it should?]
See Also
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!