Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
why am I having problems with a string and vector and how to use a *?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
hello!
i am trying to load a bunch of .txt files that are in different subject folders, but when i try to run the script with more than one subject, i get errors saying 'Must be a string scalar or character vector'.
The data is all in folders:
/Users/ll/Documents/data_analysis/HCP/seventy/HCA*/ts/cortex.txt
The only changing aspect is the subject number, and I can't figure out how to make it a variable. I have a ton of subjects to do analysis, so it would be great if i didn't indiviudally have to put the subject name in. Does anyone have any ideas? Thanks so so much.
My code:
subj = {'HCA1','HCA2'}; %HCPsubj list
for a = 1:numel(subj)
(subj{a})
end
D = ['/Users/ll/Documents/data_analysis/HCP/seventy/', subj];
for k = 1:2
name = sprintf('ts',k); % HCA1, HCA2, etc.
l = load(fullfile(D,name,'lcortex_run01regPA.txt'));
v = load(fullfile(D,name,'ventricle_run01regPA.txt'));
s = load(fullfile(D,name,'spinal_run01regPA.txt'));
0 Commenti
Risposte (1)
Walter Roberson
il 29 Dic 2019
subj = {'HCA1','HCA2'}; %HCPsubj list
D = '/Users/ll/Documents/data_analysis/HCP/seventy/';
for k = 1:length(subj)
name = subj{k};
l = load(fullfile(D,name,'lcortex_run01regPA.txt'));
v = load(fullfile(D,name,'ventricle_run01regPA.txt'));
s = load(fullfile(D,name,'spinal_run01regPA.txt'));
...
end
0 Commenti
Questa domanda è chiusa.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!