creating a menu for a .MAT file.
Mostrar comentarios más antiguos
Hi, I have a .MAT file containing information regarding currency changes and need to make a interactive menu for this.
I have tried to use X = menu('name', 'option1', 'optionN'); but cannot get this to work.
I am not very well versed in the art of the MATLAB, and thus I do not know how to import the data from my file into this command.
Any ideas for how this can be solved?
Thanks in advance (-:
Respuestas (1)
dpb
el 1 de Feb. de 2021
Your data doesn't go into the menu; it is simply a selection mechanism for the user to pick a specific action; one then has to write the code that goes along with the possible selections to do what the particular menu item implies.
I see the example in the documentation for how that is done isn't perhaps as clear in what is done as could be; the figure interrupts the code:
t = 0:.1:60;
s = sin(t);
color = ['r','b','g']
choice = menu('Choose a color','Red','Blue','Green')
plot(t,s,color(choice))
Running the above code snippet will draw the sine plot in the selected color picked out of the array color by the returned index variable, choice
If it is different code paths, a switch...end block is often the easiest construct.
1 comentario
Bjørnar Århaug
el 2 de Feb. de 2021
Categorías
Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!