How to create dialog boxes to select the file and display output ?

Hello all, I am trying to create a standalone application which opens dialog boxes to select the values and displays output. when I am trying to create dialog boxes using the following code, I am getting errors.
function trial8
prompt1={'Enter input file name (without extension [.mat]): '};
fname1 = inputdlg(prompt1); prompt2=('choose spanning window 9 or 11 (without extension [.mat]):');
fname2=inputdlg(prompt2);
[NUM,TXT,RAW]=xlsread('2.csv')
[row,col] = size(NUM);
I want the dialog box to ask for the file selction and display the corresponding output. Can anyone please help me out. Regards,

 Réponse acceptée

You got the line wrong
[NUM,TXT,RAW]=xlsread('2.csv')
You ask the user for the name of the file so you should use that input
[NUM,TXT,RAW]=xlsread([char(fname1) '.csv'])

5 commentaires

Thanks a lot for the reply.
I am having a problem with the second dialog box. The second dialog box should select a spanning window either '9' or '11' using fname2 as below:
prompt2=('choose spanning window 9 or 11 (without extension [.mat]):');
fname2=inputdlg(prompt2);
Z2=smooth(data,fname2,'rloess');
I am experiencing the following error:
??? Undefined function or method 'le' for input arguments of type 'cell'.
Error in ==> smooth at 145
if span <= 0
Error in ==> trial8 at 37
Z2=smooth(data,fname2,'rloess');
Please help me.
regards,
fname2 is a cell, you must give a string argument
char(fname2)
str2num(char(fname2))
Thank you.
I have tried char(fname2) as following:
Z2=smooth(data,char(fname2),'rloess');
I am experiencing the following error:
??? Error using ==> smooth at 188
SMOOTH: Unrecognized method.
Error in ==> trial8 at 37
Z2=smooth(data,char(fname2),'rloess');
Please help me out.
Regards,
Sorry for the above comment.
Thanks a lot for the reply. I have used str2num and it is working good.
regards,

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Performance and Memory dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by