write data from gui in excel

조회 수: 2 (최근 30일)
Andrea Gil
Andrea Gil 2011년 7월 26일
답변: Jack Griffin 2015년 5월 27일
Hi! Does anybody know how can a variable calculated on matlab GUI and stored in the handles be written on an already existing excel file?`
Or in other words, does the function xlswrite work at GUI? and if not, which function should be used instead?
Thanks a lot!

채택된 답변

Fangjun Jiang
Fangjun Jiang 2011년 7월 27일
The format for range is 'a2:c4' as an example. For a single cell, you need to specify it as 'd4:d4' for example.
The range for 4th column and i+1 row would be
[dec2base27(4),num2str(i+1),':'dec2base27(4),num2str(i+1)]
The function dec2base27() is to convert 1 to 'A', 4 to 'D', 28 to 'AB' etc. It is to facilitate the xlswrite() function. You probably don't have it. I took it from xlswrite.m. Open xlswrite.m and you can find the dec2base27() function. Make it separate so you can use it anywhere else.
  댓글 수: 1
Andrea Gil
Andrea Gil 2011년 7월 28일
Thank you very much!

댓글을 달려면 로그인하십시오.

추가 답변 (4개)

Chirag Gupta
Chirag Gupta 2011년 7월 26일
xlswrite will work from a GUI.
xlswrite(filename,handles.data)

Fangjun Jiang
Fangjun Jiang 2011년 7월 26일
Yes, xlswrite() works anywhere. You need to pay attention in the code where you have the xlswrite() line that you have access to the data, and it's better to specify the full path of the Excel file.

Andrea Gil
Andrea Gil 2011년 7월 27일
But to write only a value on a cell i+1 (i is an input from the user), how would it work?
xlswrite(filename, M, 'range'), M=the matrix 1x1, and which is the range if it is the forth column for the i+1 row? should it be Di+1:Di+1? I am not pretty sure if matlab accepts that, any idea?
Thanks!

Jack Griffin
Jack Griffin 2015년 5월 27일
pingas

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by