how can i avoid xlwrite error ?

I have a GUI which displays the data in uitable. When I save the file using pushbutton, by command uiputfile ... It saves the file, when I try to open file, it shows file locked for editing ... and at command prompt the status shows busy ... for long time... and MATLAB crashes ... by displaying the "An operation is in progress ..." message, sometimes this error does not appear... my code in pushbutton is below
data = [{get(handles.edit2,'String')} get(handles.uitable1,'ColumnName')';get(handles.uitable1,'RowName') num2cell(get(handles.uitable1,'Data'))]
[file,path] = uiputfile('*.xlsx','*.txt')
xlswrite(file,data);
disp('Save successful!!');

댓글 수: 1

Walter Roberson
Walter Roberson 2018년 7월 20일
Please do not close a question which has an answer.

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

 채택된 답변

Jan
Jan 2018년 7월 1일
편집: Jan 2018년 7월 1일

0 개 추천

What does "a long time" means exactly? Seconds, minutes, hours? What happens if the message does not appear?
Maybe your disk is full or damaged. Have you installed Excel on your machine? If so, which version? Does any detail about the problem in the system's logfiles?

댓글 수: 5

VBBV
VBBV 2018년 7월 1일
편집: VBBV 2018년 7월 1일
I have HP Pavillion Intel core i5 Laptop. I has MS Excel 2010 installed. The status bar in MATLAB shows busy ... But in command window the prompt appears normal >> as if it is done. When I hit enter key, then status in command window shows busy ... and if I try to close the MATLAB it shows 'Operation is in progress ...' Sometimes it saves successfully.. and quickly writes output excel file.
Jan
Jan 2018년 7월 1일
Can you narrow down what "sometimes" means? Does it depend on the data size? Is it reproducible?
I asked some questions for clarifications already. It would be useful to solve your problem, if you answer them.
VBBV
VBBV 2018년 7월 1일
sometimes means "when I save the file using xlswrite ... it writes output file without problem displaying message " Save successful!!!" see the code which I posted in my question, however, it does not appear and simply shows command prompt >> with cursor blinking ... then when I press enter ... the command prompt status changes to busy ... and when I try to force close the MATLAB, it shows "MATLAB is busy, Operation in progress"
VBBV
VBBV 2018년 7월 1일
I tried to use writetable to output delimited text file, instead of xlswrite or excel file, A new problem arose .. it writes everything, columnnames, rownames but not numeric data.
Walter Roberson
Walter Roberson 2018년 7월 20일
You can use 'writevariablename', false to avoid writing the column names. You can use 'writerowname', false to avoid writing the row names.

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

추가 답변 (0개)

카테고리

질문:

2018년 7월 1일

다시 열림:

2018년 7월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by