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.(adsbygoogle = window.adsbygoogle || []).push({});

What I have is

and I'm getting the errorCode (Text):sunAngleMtx(:,1) = results.Timestamp;

sunAngleMtx(:,2) = results.SubTargetID;

sunAngleMtx(:,3) = results.SunAngle;

data = {'Timestamp','SubTargetID','SunAngle'; sunAngleMtx};

xlswrite('sunAngleData.xls', data);

Any idea what I'm doing wrong. I imagine this is just me being a MATLAB noob. Error using vertcat

CAT arguments dimensions are not consistent.

Error in sunAngleCheck (line 12)

data = {'Timestamp','SubTargetID','SunAngle'; sunAngleMtx};

Thanks in advance.

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Simple MATLAB to Excel Question

**Physics Forums | Science Articles, Homework Help, Discussion**