MATLAB Answers

how can i avoid xlwrite error ?

3 views (last 30 days)
Vasishta Bhargava
Vasishta Bhargava on 1 Jul 2018
Reopened: Walter Roberson on 21 Jul 2018
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 Comment

Walter Roberson
Walter Roberson on 20 Jul 2018
Please do not close a question which has an answer.

Sign in to comment.

Accepted Answer

Jan
Jan on 1 Jul 2018
Edited: Jan on 1 Jul 2018
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 Comments

Show 2 older comments
Vasishta Bhargava
Vasishta Bhargava on 1 Jul 2018
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"
Vasishta Bhargava
Vasishta Bhargava on 1 Jul 2018
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 on 20 Jul 2018
You can use 'writevariablename', false to avoid writing the column names. You can use 'writerowname', false to avoid writing the row names.

Sign in to comment.

More Answers (0)

Sign in to answer this question.


Translated by