how to read a excel file by taking user input in dialog box

program
prompt='enter file name'; dlg_title='file name'; num_lines=1; a=input(prompt,dlg_title,num_lines);
prompt='enter sheet name'; dlg_title='Sheet name'; num_lines=1; b=input(prompt,dlg_title,num_lines);
[data,header]=xlsread(a,b);
i am getting an error "Filename must be string"

6 Kommentare

You could use uigetfile instead. That will save you from unkonown file, path issues etc.
it will only read excel file
you have to use a filter as given below
uigetfile('*.xls')
it is working thnx but what about a sheetname can we take input by using dialog box???
you can take it as an input , Also you can use activex server commands to display all the sheets existing in that xls

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Image Analyst
Image Analyst am 8 Mär. 2014

0 Stimmen

If you want to know how to control Excel with ActiveX, see my attached demo. You can do a lot more than is in my demo, such as getting all the sheet names, etc.

Gefragt:

am 7 Mär. 2014

Beantwortet:

am 8 Mär. 2014

Community Treasure Hunt

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

Start Hunting!

Translated by