Warning: Attempt to write an unsupported data type to an ASCII file. I am trying to save a matrix to an ascii file but it keep throwing this error
조회 수: 17 (최근 30일)
이전 댓글 표시
I am writing a code for a homework assignment that does a variety of things. One of the thing it has to do is load antennaData.mat and manipulate the theta and rho vector and then concatenate them into a matrix. Then, I have to save the matrix to an ascii file. All is well and good but when I try to save the matrix I get the error "Warning: Attempt to write an unsupported data type to an ASCII file"
This is the sample of my code that throws the error. I looked at other question regarding similar issues but those errors were the resulkts of matrices not using numberic elements. But my matrix has numeric values as it should. So I'm very lost as to why its throwing an error.
load antennaData.mat
theta = [theta(1:end); 2*pi + theta(2:end)];
rho = [rho(1:end); 2*pi + rho(2:end)];
M = [theta, rho];
save 'M' '-ASCII';
댓글 수: 2
채택된 답변
Cris LaPierre
2021년 10월 9일
save M.txt M -ascii
% or
save('M.txt', 'M', '-ascii')
댓글 수: 3
Cris LaPierre
2021년 10월 9일
You need to be aware of the proper syntax in order to get the result you expect. Use the doc for that. Here is a list of valid syntaxes for save
- save(filename)
- save(filename,variables)
- save(filename,variables,fmt)
- save(filename,variables,version)
- save(filename,variables,version,'-nocompression')
- save(filename,variables,'-append')
- save(filename,variables,'-append','-nocompression')
- save filename
With only 2 inputs, I suspect it was trying to treat '-ascii' as your variable
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!