- #1
swartzism
- 103
- 0
I've discovered that MATLAB is not my forte. I have a 51x3 matrix that I want to print to an Excel sheet, but with column headers. I can get the matrix into an Excel file and I can get the headers into an Excel file, but I cannot figure out how to get the two together. I've looked up how to do this and it is not working for me.
What I have is
and I'm getting the error
Any idea what I'm doing wrong. I imagine this is just me being a MATLAB noob.
Thanks in advance.
What I have is
Code:
sunAngleMtx(:,1) = results.Timestamp;
sunAngleMtx(:,2) = results.SubTargetID;
sunAngleMtx(:,3) = results.SunAngle;
data = {'Timestamp','SubTargetID','SunAngle'; sunAngleMtx};
xlswrite('sunAngleData.xls', data);
and I'm getting the error
Error using vertcat
CAT arguments dimensions are not consistent.
Error in sunAngleCheck (line 12)
data = {'Timestamp','SubTargetID','SunAngle'; sunAngleMtx};
Any idea what I'm doing wrong. I imagine this is just me being a MATLAB noob.
Thanks in advance.