Adding functions permanently to matlab

51 ビュー (過去 30 日間)
joseph Frank
joseph Frank 2011 年 7 月 2 日
コメント済み: AMM 2020 年 5 月 21 日
I have many self developed functions in a folder called Finance (C:\Documents\MATLAB\Finance). I sthere a way to add these functions permanently to my matlab path so whenever i use a script this script would call them automatically?

採用された回答

Matt Fig
Matt Fig 2011 年 7 月 2 日
Yes, look under File>Set Path. Add the directory Finance to the path. This should persist between sessions.
  1 件のコメント
Nagabhushan SN
Nagabhushan SN 2018 年 8 月 31 日
In MatLab R2018a, look under Home > ENVIRONMENT > Set Path

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

その他の回答 (2 件)

Paulo Silva
Paulo Silva 2011 年 7 月 2 日
use pathtool to select that folder and save

the cyclist
the cyclist 2011 年 7 月 2 日
Yes. Use the path() or addpath() command in a file called startup.m, in the top-level MATLAB directory. For example, where is how I added a utilities directory (on a Mac):
path(path,genpath('/Users/thecyclist/Documents/MATLAB/utilities'));
That file is run at MATLAB start.
  3 件のコメント
John D'Errico
John D'Errico 2020 年 5 月 21 日
This is a completely different question. Please don't resurrect an old question to ask a new one.
But do NOT put functions in the matlabroot directories. The toolbox directories are cached on startup, so any changes you make to your personal functions will not be seen.
AMM
AMM 2020 年 5 月 21 日
John-
I asked here because I thought my query was directly relevant to the OP's question (modulo "how" vs. "where"). My apologies. I'll re-post this as a new question.
Thanks also for the info about caching at startup. I can easily imagine this would result in confusing/unexpected behavior if I were to edit any of those functions during a session, then fail to quit/restart. Cheers.

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

カテゴリ

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