reading and writing the same Excel file in app designer
3 ビュー (過去 30 日間)
古いコメントを表示
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!
0 件のコメント
採用された回答
Geoff Hayes
2020 年 3 月 28 日
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).
0 件のコメント
その他の回答 (1 件)
ZM
2020 年 3 月 28 日
編集済み: ZM
2020 年 3 月 28 日
2 件のコメント
Geoff Hayes
2020 年 3 月 28 日
Zhina - did you try using readtable instead of xlsread? What happens if, for a new file, you create and write to it with writetable and then try this again? For example,
writetable(s1,'edit_firststage2.xlsx');
writetable(s1,'edit_firststage2.xlsx');
Does the second writetable fail? I realize that you are writing the same data to the same file, but this would be an interesting test to see if writing to pre-existing files is a problem OR is it just a problem when you try to read from a file (with xlsread) and then try to write to that same file?
参考
カテゴリ
Help Center および File Exchange で Data Import from MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!