How to import a function from another package

13 ビュー (過去 30 日間)
Gabriela Garaizabal Etxeberria
Gabriela Garaizabal Etxeberria 2021 年 4 月 24 日
編集済み: per isakson 2021 年 4 月 26 日
Hello community,
I am trying to use a function which is in another package called model in one class. I am trying to import the package like this so I can use the function Parametros_Entrada.
However, I get an error all the time that says the following: Undefined function 'Parametros_Entrada' for input arguments of type 'double'. I tried to change the function to the project root and it works well, the problem is that the import does not take it well. I have tried ifferent things with the import but none comes out like:
  • import model.*
  • import model.Parametros_Entrada.m
  • import @model.*
  • import @model.Parametros_Entrada
And so on...Could you help me?
Thank you so much!
Gabriela

採用された回答

per isakson
per isakson 2021 年 4 月 26 日
編集済み: per isakson 2021 年 4 月 26 日
Your folder, Model, is not a Matlab package. Package folders always begin with the + character. See Packages Create Namespaces.
IMO: The Matlab function, import(), is of little use (with Matlab m-code), you need to repeat it in every function. I never use it, instead I write the fully qualified names.

その他の回答 (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