Save as xlswrite file in user specified path and user specified name

Hi,
I have an excel templete created using matlab, I want to use the same templete to store data from appdesigner, I want the new excel sheet with data to be stored in user specified name and path. Please help me with this.
Thank you in advance for your help!

Answers (1)

You didn't say anything about how yuor data is stored
But something like this...
writematrix(data,'FileName.xlsx','Sheet','user specified name')
if your data is in a Table then use writetable.
There is also writetimetable,& writecell.

3 Comments

I have 20X1 matrix, which needs to be stored in the cell B7:B27 in the standard templete created earlier using matlab.
I want to copy the same templete to store the above matrix in the cells as a new excel file and to name it according to the user convenience and also to save the copy in the user specified directory.
The below code saves the new excel file in the matlab code directory, but I want the user to decide name and path where it is to be stored
a = [1:20];
filename = "NG_Templete.xlsx";
str = "newfile.xlsx";
copyfile("NG_Templete.xlsx",str);
xlswrite(str,a,1,"B7:B27");
uiputfile
Will open a dialogbox for the user to input a file name and path

Sign in to comment.

Tags

Asked:

on 16 Jun 2021

Commented:

on 21 Jun 2021

Community Treasure Hunt

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

Start Hunting!