You can try:
- reading the numerical data as "string"
- replace the "comma" with a "dot"
- convert the cellarray to a char array
- convert the string to number with the function str2num
a possible implementatino could be:
fid=fopen('RAD.rad','r')
% Read the data as strings
x=(textscan(fid, '%s', 'headerlines', 19))
% Remove the last row (string: END OF FILE)
x{1}(end-2:end)=[];
fclose (fid)
% Define the number of variables
n_vars=5
% Get the number of data
n_data=length(x{1})
% Identify the number of rows
n_rows=n_data/n_vars
data=str2double(strrep(x{1},',','.'));
the_data=reshape(data,n_vars,n_rows)'
Edit following the comments of the OP
I've tested the code with the file you've posted.
I've updated the code to discard the last line of the input (since it is the string "END OF FILE").
The x
variable is {11550x1 cell}
so the data are stored in x{1}
.
The second part of the code, generate the matrix the_data
which contains the datra read from the inout file.
>> whos the_data
Name Size Bytes Class Attributes
the_data 2310x5 92400 double