Data with different length of rows
3 views (last 30 days)
I have following question. I have data like this:
1 2 3 4 5 6 7 8 9
1 2 3 4
I want to calculate average of each row.
I have following code:
Unfornatelly does not work, I got the error:
Unable to read file 'filei.txt'. Input must be a MAT-file or an ASCII file containing numeric data with
same number of columns in each row.
I have no idea what to do, do you have any advice?
Any help is aprriciated.
Star Strider on 26 Aug 2020
fidi = fopen('file.txt','rt');
k = 1;
row = fgetl(fidi);
avg(k,:) = mean(str2num(row));
k = k+1;
RowMeans = avg