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

Rik
Rik 2017년 10월 22일
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?

댓글을 달려면 로그인하십시오.

 채택된 답변

KSSV
KSSV 2017년 10월 23일

2 개 추천

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.

추가 답변 (0개)

태그

질문:

2017년 10월 22일

답변:

2017년 10월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by