Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Index Exceeds Matrix Dimensions - Combining variables from different .mat files into one

1 回表示 (過去 30 日間)
Mary
Mary 2013 年 6 月 12 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by