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

23 views (last 30 days)
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';

Accepted Answer

Cris LaPierre
Cris LaPierre on 9 Oct 2021
I'm not able to reproduce your error, but try following this example. I would code this as
save M.txt M -ascii
% or
save('M.txt', 'M', '-ascii')
  3 Comments

Sign in to comment.

More Answers (0)

Categories

Find more on Structures in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!