Create a Menu From Excel Data

Is there a way in which you can create a menu that will take text strings from an Excel file and place them as the options for the menu, and if so how do I do that?

 Respuesta aceptada

Laura Proctor
Laura Proctor el 18 de Abr. de 2011

1 voto

You can read the strings from the cells using XLSREAD, then use MENU to create the menu.
For example:
[num,txt,raw] = xlsread('myfile.xls');
choice = menu('Choose an item',txt)

3 comentarios

Julie
Julie el 18 de Abr. de 2011
Thank you so much! Do you know of any way in which to delete the first item in the list since it is only the header and I do not need it in my menu.
Laura Proctor
Laura Proctor el 19 de Abr. de 2011
In that case, you can just use:
choice = menu('Choose an item',txt(2:end))
Or, redefine txt and use the same syntax as above:
txt = txt(2:end)
Julie
Julie el 27 de Abr. de 2011
I am now trying to do the same thing with numerical values, but I cannot get it to work. Do I have to do something different?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Import from MATLAB en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 18 de Abr. de 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by