is there a way for a creation of variables for machine learning inside a loop from a dataset of waves
조회 수: 4 (최근 30일)
이전 댓글 표시
i have this dataset of wavelengths, problem is they are flipped and as such whenever i load the data i run a secondary part to rotate and flip, though so far i only have a way to read it and not really make use of it inside an ai machine learning thing
clc; clear; close all;
load('-mat','sub-036_task-eyesclosed_eeg.set','data','group','subject')
data_plot=flip(rot90(data,1));
N=width(data_plot);
B=height(data_plot);
figure
%----------------------- all of this is just for plotting and seeing it in stackedplot
T = array2table(data_plot, 'VariableNames',"CH: "+(1:N));
s = stackedplot(T);
s.AxesProperties(1);
ax = findobj(s.NodeChildren, 'Type','Axes');
set(ax, 'YTick', []);
%--------------------------
xlim([-500 B+500])
grid on
set (zoom(gcf), 'Motion', 'horizontal', 'Enable', 'on');
%--------------------------
i was wondering if there is a way to make like a for loop so in each loop i get data_1 then data_2 data_3 etc etc etc or how could i use a machine learning or signal labeler app or ai or artificial neural network and deal with the issue that i need to rotateflip the data?
댓글 수: 2
Stephen23
2024년 12월 8일
편집: Stephen23
2024년 12월 8일
"i was wondering if there is a way to make like a for loop so in each loop i get data_1 then data_2 data_3 etc etc etc "
The most important change is to always LOAD into an output variable:
S = load(..);
which you can then trivially loop over the fieldnames:
F = fieldnames(S);
for k = 1:numel(F)
A = S.(F{k});
.. do whatever with A
end
See also:
답변 (1개)
Walter Roberson
2024년 11월 28일
data_names = who('-file', 'sub-036_task-eyesclosed_eeg.set', '-regexp', '^data_\d+$');
for DNI = 1:length(data_names)
thisvar = data_names{DNI};
DS = load('-mat','sub-036_task-eyesclosed_eeg.set', thisvar);
data = DS.(thisvar);
%stuff
end
댓글 수: 6
Walter Roberson
2024년 12월 7일
x = [1 2 3 4];
y = [100 200 300 400];
data = [x; y];
data
flip(data)
data.'
flip(data.')
rot90(data,1)
flip(rot90(data,1))
so data.' gives the same result as flip(rot90(data,1)).
Stephen23
2024년 12월 8일
Note that LOAD accepts a regular expression directly:
data = load('sub-036_task-eyesclosed_eeg.set', '-regexp','^data_\d+$');
참고 항목
카테고리
Help Center 및 File Exchange에서 Time and Frequency Domain Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!