Save data into excel in standalone app

6 次查看(过去 30 天)
Hello everyone.
i'm trying to make an app that will generate data then save it in exiting excel file, however in the matlab it works fine with me.
but when i convert it to standalone app the program will always save the data on the same cell in the excel file.
here is the code i used to reach the excel file.
%% ~.
[~,~, existingData] = xlsread('Results.xlsx');
N = size(existingData,1);
% add the new values (your input) to the end of Excel file
CC0=strcat('A',num2str(N+1));
CC1=strcat('B',num2str(N+1));
CC2=strcat('C',num2str(N+1));
CC3=strcat('D',num2str(N+1));
CC4=strcat('E',num2str(N+1));
CC5=strcat('F',num2str(N+1));
CC6=strcat('G',num2str(N+1));
CC7=strcat('H',num2str(N+1));
CC8=strcat('I',num2str(N+1));
CC9=strcat('J',num2str(N+1));
CC10=strcat('K',num2str(N+1));
CC11=strcat('L',num2str(N+1));
% disp(N);
xlswrite('Results.xlsx',app.NEW3,'Sheet1',CC0);
xlswrite('Results.xlsx',app.NEW1,'Sheet1',CC1);
xlswrite('Results.xlsx',app.AGE1,'Sheet1',CC2);
xlswrite('Results.xlsx',app.Gender,'Sheet1',CC3);
xlswrite('Results.xlsx',app.NEW2,'Sheet1',CC4);
xlswrite('Results.xlsx',app.GDTT1,'Sheet1',CC5);
xlswrite('Results.xlsx',app.GDTT2,'Sheet1',CC6);
xlswrite('Results.xlsx',app.GDTT3,'Sheet1',CC7);
xlswrite('Results.xlsx',app.GDTT4,'Sheet1',CC8);
xlswrite('Results.xlsx',app.GDTT5,'Sheet1',CC9);
xlswrite('Results.xlsx',app.GDTT6,'Sheet1',CC10);
xlswrite('Results.xlsx',app.AVERAGE,'Sheet1',CC11);
closereq

回答(1 个)

BhaTTa
BhaTTa 2025-8-14
Hey @Oddineus, If you are using MATLAB App Designer, please refer to the below MATLAB Answers to solve your problem: https://www.mathworks.com/matlabcentral/answers/1783000

Community Treasure Hunt

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

Start Hunting!

Translated by