ML Equalizer works now.
Not yet perfectly integrated into all the routines
This commit is contained in:
30
projects/ML_based_MLSE/read_csv.m
Normal file
30
projects/ML_based_MLSE/read_csv.m
Normal file
@@ -0,0 +1,30 @@
|
||||
%% read_wpd_csv.m
|
||||
% Minimal importer for WebPlotDigitizer multi-curve CSV
|
||||
|
||||
filename = 'wpd_datasets.csv'; % <-- set your file path here
|
||||
T = readtable(filename);
|
||||
|
||||
% Read header row manually
|
||||
fid = fopen(filename);
|
||||
hdr1 = strsplit(strrep(fgetl(fid), '"', ''), ','); % curve names
|
||||
hdr2 = strsplit(strrep(fgetl(fid), '"', ''), ','); % X/Y header row
|
||||
fclose(fid);
|
||||
|
||||
% Extract unique curve names
|
||||
names = hdr1(~cellfun('isempty',hdr1));
|
||||
|
||||
% Create struct for each curve
|
||||
mii = struct();
|
||||
for i = 1:numel(names)
|
||||
base = matlab.lang.makeValidName(strrep(names{i},' ','_'));
|
||||
xi = 2*(i-1)+1; % X column
|
||||
yi = xi+1; % Y column
|
||||
mii.(base).X = T{:,xi};
|
||||
mii.(base).Y = T{:,yi};
|
||||
|
||||
% also create workspace variable "name_wpd"
|
||||
assignin('base',[base '_wpd'], mii.(base));
|
||||
end
|
||||
|
||||
disp('Imported datasets:');
|
||||
disp(fieldnames(mii));
|
||||
Reference in New Issue
Block a user