is there a linux equivalent of cell arrays? (to input into MatLab functions?)
2 次查看(过去 30 天)
显示 更早的评论
Right now I have a MatLab function that calls 6 other functions in SPM:
addpath 'C:\Users\APK-User\Documents\spm12'
function dothejob_NASA (subjID, timepoint)
for i=1:length(subjID)
for j=1:length(timepoint)
sliceTiming_01_NASA(subjID{i},timepoint{j})
realignReslice_02_NASA(subjID{i},timepoint{j})
coregister_03_NASA(subjID{i},timepoint{j})
segment_04_NASA(subjID{i},timepoint{j})
normalize_05_NASA(subjID{i},timepoint{j})
smooth_06_NASA(subjID{i},timepoint{j})
end
end
In MatLab, if I enter the subjID and timepoints in within { }, then this function runs perfectly and calls the other SPM functions:
%Enter subjects and time points:
subjID = {'1261'};
timepoint = {'05','06'};
dothejob_NASA (subjID, timepoint)
However, I would like to be able to run this function on bash... e.g., in my Mac terminal, I would like to be able to write something like:
subjID = {'1261'};
timepoint = {'05','06'};
matlab -nodesktop -nosplash -r dothejobNASA subjID timepoint
This is so that I could run this function on Mac terminal (and on a high performance computing cluster) with many subjects and timepoints in the future without going back into MatLab to edit the subjID and timepoints.
I know that I can't write exactly subjID = {'1261'}; in Mac terminal, but is there something similar that I could substitute to feed into this function? (or would I need a totally different approach?)
0 个评论
采纳的回答
Walter Roberson
2017-10-11
编辑:Walter Roberson
2017-10-11
subjID = "{'1261'}"
timepoint = "{'05','06'}"
matlab -nodesktop -nosplash -r "dothejobNASA($subjID, $timepoint)"
Or, better,
matlab -nodesktop -nosplash -r "try; dothejobNASA($subjID, $timepoint); catch; end; quit"
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!