xlswrite() and writematrix() returning no errors, yet data is not showing up in excel file
Show older comments
I have used xlswrite() and writematrix() many times and never had an issue. I am trying to use it in a GUI and I am seeing no errors, yet the output data will not show up in my resepctive excel file. The GUI allows the user to input what row the data will be going to (excelRow). Additionally, I tried using xlsread() to read a column of numbers and it returned empty. Could this be something with excel? Or is there something wrong with my code
% write out Beta fit
betaRange = ['C' num2str(excelRow)];
xlswrite('FRAP.xlsx',B_fit,3,betaRange)
I also tried using a blank matlab code and copying the example from the documentation on xlswrite() with my filename, and still did not see anything in the excel file.
filename = 'FRAP.xlsx';
A = [12.7 5.02 -98 63.9 0 -.2 56];
xlswrite(filename,A)
Any suggestions? I am using Matlab 2020a, and my excel file is a .xlsx file
4 Comments
dpb
on 25 Apr 2020
Would need to see a minimum working example that doesn't work to try to recreate -- the code on the outside looks ok with the possible exception of what the data in B_fit is -- xlswrite only writes either numeric or cell array data--it will fail silently on other mixed data types like a struct or cell array that isn't constructed as single element per cell. This is explained in the documentation:
A
Input matrix, specified as a two-dimensional numeric, character array, or string array, or, if each cell contains a single element, a cell array.
If A is a cell array containing something other than a scalar numeric or text, then xlswrite silently leaves the corresponding cell in the spreadsheet empty.
NB:
"xlswrite is not recommended. Use writetable, writematrix, or writecell instead. For more information, see Compatibility Considerations."
Tresa Elias
on 25 Apr 2020
dpb
on 25 Apr 2020
Sounds like a problem in not having write access or the working path isn't where you think is or somesuch...outside the specific environment it won't be possible to duplicate the symptoms--why suggested a minimum working example that illustrates the problem that can post. Besides then others having at least a chance of duplicating the issue and thus debugging it, often one finds that one discovers the problem in going through the exercise.
Areej zaki
on 7 Apr 2021
Did you find an answer as i am facing the same problem
Answers (0)
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!