Hi, I use the script below to create two x,y-arrays and to build a matrix with the transposed y-columns of the arrays. Each array correspond to a row of the matrix. (I create, save and import again only to simulate a real situation because I have i-arrays of collected data)
fid = fopen('1.txt', 'wt');
fprintf(fid, [repmat('%g\t', 1, size(M1,2)-1) '%g\n'], M1.');
fid = fopen('2.txt', 'wt');
fprintf(fid, [repmat('%g\t', 1, size(M2,2)-1) '%g\n'], M2.');
M = NaN(i,j);
for filenumber = 1:i;
A = cell2mat(A);
M(filenumber,A(:,1)) = A(:,2);
The script works well for entire increment (in the case above 1). The cells m13, m14 and m15 have a value following the range of 1.txt.
In the same way the values of the second row depends on the new range of 2.txt. One can change the ranges of 1.txt (=M1) and 2.txt(=M2) by varying X1 and X2 above and the matrix will adjust accordingly.
Problem: My real i.txt arrays have increments of 0.5 and if I change the increment above I obtain the following error:
Subscript indices must either be real positive integers or logicals.
I wonder if someone could help me to fix this.
Thank you in advance for your help.