How do I display a string from a variable name?

I am having trouble with xlsread. I am having the user input a variable and setting it to Pick. Because the variable i want to display is a string i am having problems with syntax. Here is my code so far. I have tried many different ideas but I cant solve my problem.
Pick = input('Please enter a song ranking from 1 to 50 to see the title artist and album: ')
[~,txt] = SongName(Pick)
Artistname = ArtistName(Pick)
Albumname = AlbumName(Pick)

1 Commento

Have a read here and here. It will greatly improve your chances of getting an answer.
We don't know your functions, you didn't properly format your code, you didn't even show how this has anything to do with Excel. How are we supposed to help you if you don't provide a complete question?

Accedi per commentare.

 Risposta accettata

Replace the line:
Pick = input('Please enter a song ranking from 1 to 50 to see the title artist and album:') ;
with:
Pick = input('Please enter a song ranking from 1 to 50 to see the title artist and album: ','s') ;
What you input is a string now. If you are entering a number, you can convert it to number using str2num. Please reap about the function input.

Più risposte (0)

Tag

Richiesto:

il 22 Ott 2017

Risposto:

il 23 Ott 2017

Community Treasure Hunt

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

Start Hunting!

Translated by