フィルターのクリア

How to call function in different file path

136 ビュー (過去 30 日間)
Khang Nguyen
Khang Nguyen 2023 年 5 月 10 日
回答済み: Shuba Nandini 2023 年 5 月 29 日
hi,
I am currently working on a big project, to organize it I want to create many folder and put the functions in it. for example:
if I want to write code on work.m that is in the work folder. How can I call fun1.m and fun2.m that is in different folder? I could not find anything useful online so I hope someone can help.
Thank you.

回答 (1 件)

Shuba Nandini
Shuba Nandini 2023 年 5 月 29 日
Hello,
It is my understanding that you want to call ‘fun1.m[SK1] and ‘fun2.m’ that is in different folder by the ‘work.m’ file which is defined in work folder.
You can call the function directly from the ‘work.m’ file by adding that file to the search path. If you want to add multiple folders to the search path, you can use the “addpath” command.
Please refer to the below link to know more about “addpath” command:
Hope this helps!

カテゴリ

Help Center および File ExchangeSearch Path についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by