Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Index Exceeds Matrix Dimensions - Combining variables from different .mat files into one
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hello Again!
(I'm new to using structs and dir's so I apologize for all of the questions lately)
I'm trying to load .mat files from two different directories, and then pull variables from them to save into a new .mat file
Below is my current code:
function organizeData
%%Pull Data from relevant .mat files
eegDir = 'Unprocessed\'
eegData = dir([eegDir,'*.mat'])
for i = 1:numel(eegData)
eegName=eegData(i).name;
load (fullfile(eegDir,eegName))
a=regexp(eegName,'_','split');
experimentName = a{1};
%%Pull Log Data from relevant .mat files
lDir = 'unprocessedLogs\'
logData = dir([lDir,'*.mat']);
for k = 1:numel(logData)
logName = logData(k).name;
if strcmp(logName, experimentName) == 1
load (fullfile(lDir,logName))
block(1).blue.participantID = r(1:5).blue.participant
block(1).green.participantID= r(1:5).green.participant
block(2).blue.participantID = r(6:10).blue.participant
... more code
save_filename = (logName)
else
end
end
end
I'm trying to call r(1) - r(5)'s information to load into the new struct. Am I going about this wrong?
Thank you again for all of the continued help!
- Mary
0 comentarios
Respuestas (0)
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!