How to get MATLAB to process the files specified in batch

4 ビュー (過去 30 日間)
Yuxiao Mei
Yuxiao Mei 2022 年 5 月 17 日
回答済み: Yuxiao Mei 2022 年 5 月 17 日
How to get MATLAB to work with the files specified in batch. I have converted the program edited in matlab to .exe. I hope that batch will enable .exe to batch process any file I specify in batch. That is, I just need to change the name of the folder in batch, and .exe can batch process it.

回答 (2 件)

Walter Roberson
Walter Roberson 2022 年 5 月 17 日
You can have the code call uigetdir() if you want to prompt the user for the directory name.
Or you can make the main function into one that accepts one or more argument, and then if someone used the executable name and then the directory name on the Windows command line, then the function would receive the directory name as a parameter.
Caution: it is not uncommon in Windows for directory names to have spaces in them, but it the user were to command, for example
PlotOde.exe C:\Users\Sam\Assignment 7\Odes
then the part before the 7 would be one parameter, and the 7 on would be a second parameter. Windows would consider the space as the end of the parameter unless you make sure to use double-quotes to tell Windows to treat it as a single parameter.
  1 件のコメント
Yuxiao Mei
Yuxiao Mei 2022 年 5 月 17 日
Thanks for the reply.
I don't know the path of the folder that needs to be processed, I only know the name of the file plus. How do I get batach or matlab to automatically look up the path and process it via .exe

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


Yuxiao Mei
Yuxiao Mei 2022 年 5 月 17 日
I am now entering the path to manually locate it.
I want matlab to automatically locate the path to the folder by the folder name.
How do I do this?
cd D:\Mei\folder1;
cd %check Position
sourcepath = 'D:\Mei\folder1';
Definationpath = 'D:\Mei\2';
Definationpath = 'D:\Mei\2';%Zielordner

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by