Search code examples
excelmatlabwritefile

[MATLAB]: Writing data in Excel return always 1


I want to write an array of increasing integer from Matlab to an Excel file.

So I wrote the following code :

T=linspace(1,172800,172800);
xlswrite('example.xlsx',T,'A1:A172800');

The result is an excel sheet with the first column (from row1 to row172800) all filled by "1" and not by expected values.

No errors are printed in Matlab workspace.

What I should do to achieve my objective?


Solution

  • You'll need to transpose T first :

    T=transpose(linspace(1,172800,172800));
    xlswrite('example.xlsx',T);