MATLAB: Reading and writing the same Excel file in app designer

appdesignerexcel file

Hello;
I want to create a table that reads from an excel file, and after opening the table the user edit the table, and tthe editing should be saved in the same excel file
when the second time, the table is opend it must be updated.
my code:
function startupFcn(app)
Data = xlsread('edit_firststage2.xlsx');
———–
function SendButtonPushed(app, event)
writetable(s1,'edit_firststage2.xlsx') % when I run the program it give rror in thiss line and it saying "you do not have permission"
Thank you in advance!

Best Answer

ZM - check to see if you have permission to read and write to that file. If you do, then consider using readtable instead of xlsread to see if that somehow (?) allows you to better read and write to the same file (as xlsread isn't recommended to be used).