use variables of one .m file in another .m file

90 ビュー (過去 30 日間)
Elise
Elise 2014 年 6 月 4 日
回答済み: Sara 2014 年 6 月 4 日
Hi all!
I want to have one .m file declaring a lot of constants and use these constants in my other .m files. Such that if I want to change these constants, I only have to change one file, and not have to go through all my .m files. Is this possible?
Thanks a lot!

採用された回答

Sara
Sara 2014 年 6 月 4 日
You can define the constants in one file and save them in a mat file:
save('myfile.mat','name_var1','name_var1')
and read in this file in the other m-files:
load('myfile.mat')

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by