How to convert xlswrite to writematrix?
조회 수: 2 (최근 30일)
이전 댓글 표시
I have a code that uses xlswrite and works in R2016. When I run it in R2019a Matlab online, it gives an error on xlswrite and suggests to use writematrix instead. I followed the format of writematrix, however, there is still an error using writematrix. How do I convert xlswrite to writematrix? Thanks.
댓글 수: 3
Guillaume
2019년 5월 7일
If you say you get an error always give us the full text of the error message (everything that is red).
Note that matlab online runs on linux, so writematrix and more so xlswrite are limited in what they can write to an excel file.
dpb
2019년 5월 7일
Ah...I was unaware of that tho makes sense...that in fact is likely the root cause indeed for xlswrite; still indeterminate for writematrix
답변 (2개)
Jeremy Hughes
2019년 5월 7일
XLSWRITE can write either a matrix (e.g. [ 1 2 4;5 7 8] or a cell {'a' 'b';'c' 'd'})
If your input is a cell, use WRITECELL.
댓글 수: 2
Jeremy Hughes
2019년 5월 8일
Based on the comment below:
writematrix(dataset,filename,sheet,xlRange)
should be:
writematrix(dataset,filename,'Sheet',sheet,'Range',xlRange)
Jojo Blanza
2019년 5월 8일
댓글 수: 1
dpb
2019년 5월 8일
What if you use writematrix but to a text file? I'm betting odds are good that will work and if so it's related to the issue of is Excel actually supported for the platform you're trying to write to as Guillaume suggested.
But, it would still be agoodthing™ if we could see the actual form of the data you're trying to write; I wonder with the variable name dataset are you, by any chance, using a ML table or the old Statistics TB dataset class, are you??? But, if the latter, that variable name is aliasing the constructor for the class...
What does
whos dataset
return at command line?
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!