How to merge multiple scripts in MATLAB
显示 更早的评论
Hi,
I am running an analysis using SPM, and want to run multiple scripts at once. One way to do this is to copy and paste each subject's script into a new one and run them together. However, this is quite time consuming considering I have 155!
Therefore, I was wondering if there is an easier way to merge multiple script files in MATLAB?
Thank you, M
回答(2 个)
Titus Edelhofer
2014-7-8
Hi,
you might just create a script that uses "run" to run the other scripts based on the output of "dir"? Something like
batchFiles = dir('PathToBatchfiles\*.m');
for i=1:length(batchFiles)
run(fullfile('PathToBatchfiles', batchFiles(i).name));
end
Titus
2 个评论
Mobeen
2014-7-8
Titus Edelhofer
2014-7-10
Most probably the path is wrong. What does "batchFiles" look like? Is it empty, i.e., of size 0x1 or something similar?
Joseph Cheng
2014-7-10
0 个投票
when you say batch file are you talking about *.bat files? if so then you are not looking for run() command. you'll be wanting to use system() or dos() or ! (exclamation-mark) to run a bat file.
see the documentation (doc system) on how to use it.
类别
在 帮助中心 和 File Exchange 中查找有关 Troubleshooting in MATLAB Compiler SDK 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!