I am converting a 16x16 double mat file into tab-separated .txt files for my colleague to eventually paste the data into a compiled Excel file. The code I have right now displays the correct number but puts all the values in the first cell of each row in Excel. I also viewed the .txt files in Matlab which seems to be tab-separated, but just not on Excel.

load('Lengths.mat')
Len = num2str(DistMatrix)
diary('Lengths.txt')
disp(Len)
diary off 

I also tried using dlmwrite and writematrix without success.

Example of dlmwrite:

A = load('Lengths.mat')
dlmwrite('Lengths2.txt', A, 'delimiter','\t','newline','pc')

With the above codes, I will receive error "Undefined function 'real' for input arguments of type 'struct'."

0 Answers