フィルターのクリア

is there a linux equivalent of cell arrays? (to input into MatLab functions?)

1 回表示 (過去 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?)

採用された回答

Walter Roberson
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"
  1 件のコメント
Kathleen Hupfeld
Kathleen Hupfeld 2017 年 10 月 12 日
Fantastic, thank you so much! One note, it only worked for me in linux without the spaces on either side of the equal signs; e.g., subjID="{'1261'}"

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by