フィルターのクリア

How to save gui data in excel

5 ビュー (過去 30 日間)
nur iman athilah
nur iman athilah 2021 年 3 月 1 日
コメント済み: nur iman athilah 2021 年 3 月 3 日
How can i save the gui data into excel? and I want it to be save into new row everytime i click the save button. I tried this but it just in same row everytime.
rownumber=xlsread('COLONPOLYPS.xlsx');
%code code code
%then, in the end:
rownumber=rownumber+1;
xlswrite('COLONPOLYPS.xlsx',arr);
  2 件のコメント
Mathieu NOE
Mathieu NOE 2021 年 3 月 3 日
hello
no surprise , as it seems you don't specify the range where to write the data, so xlswrite keeps overwritting in the first row
you have to specify the range : xlswrite(FILE,ARRAY,SHEET,RANGE)
also xlswrite is outdated, please consider using writetable
nur iman athilah
nur iman athilah 2021 年 3 月 3 日
i changed the code. But why the data didnt save in new row when i click the save button.
xlworkbook = xlApp.Workbooks.Open('colon.xlsx');
xlsheet = xlworkbook.ActiveSheet;
mydata=arr;
data=xlsread('colon.xlsx');
%Determine last row
last=size(data );
newRange=last+1;
xlCurrRange = xlsheet.Range(['A', num2str(newRange),':J', num2str(newRange)]);
xlCurrRange.Value2 = mydata;
%Save and Close the Excel File
invoke(xlworkbook,'Save');
invoke(xlApp,'Quit');
xlApp.delete;

サインインしてコメントする。

採用された回答

Abdulaziz M. Ghaleb
Abdulaziz M. Ghaleb 2021 年 3 月 3 日
First, you need to note that xlswrite is not recommended starting form Matalb 2020a
There are another functions to be used instead, you can check the documentations.
As @Mathieu NOE stated, it is the range and need to be handeled carefully.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by