Cannot load "map".
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I am very, very new to coding. Am trying to use the 'map' function of MATLAB and I get the attached error message.
map
Error using uimenu
Unrecognized property call for class Menu.
Error in map (line 149)
menurot1 = uimenu(menug,'label','Default',...
Index exceeds the number of array elements. Index must not exceed 0.
Error in map (line 255)
flag = get(sh(3),'user');
Error while evaluating UIControl Callback.
I have no idea what to do. If you can help, please keep it as simple as possible. Thank you!
3 Commenti
Walter Roberson
il 3 Nov 2022
See https://www.mathworks.com/matlabcentral/answers/1836543-cannot-access-the-map-function#answer_1085778 in which I did a bunch of corrections to the user code.
The user code had a number of places where it created a vector that mixed graphics handles and double precision numbers in the same vector, and then used constant numeric offsets to pick out the desired portion. At least two different such vectors were used. Mixing handles and floating point values was possible in HG1 as HG1's user interface to graphics handles was as floating point numbers.
My adjusted version changed one of the two vector formats into a struct with named fields and appropriate relative offsets. But that was a non-trivial amount of work, and I did not go through and do the same thing for the other vector format.
The code as it now stands has the problem that it tries to use the UserData field of an uninitialized graphics handle. It is basically a logic error in the original code, which initializes the second member of a pair of handles but not the first member of the pair but expects to be able to reference the first member anyhow. Really that part could use some debugging to figure out what the intent there was to fix it properly. The short-cut would be to initialize the first member of the pair to groot to give it a place to access the UserData.... I think that is why the code functioned at all in HG1, that the uninitialized handle would have been 0 which would have corresponded to the HG1 graphics root...
Risposte (0)
Vedere anche
Categorie
Scopri di più su Graphics Object Properties 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!