why inputname() does not show any results when for example "objname(1)" is used as input name.

4 ビュー (過去 30 日間)
Maniraj M
Maniraj M 2017 年 12 月 26 日
回答済み: Maniraj M 2018 年 1 月 8 日
If I have a object named 'objname' and its has N-field or elements inside. I can safely call the function with 'objname(1) or objname(2) etc'. 'inputname()' function gives output when just 'objname' is used as input arg. It fails if 'objname(1)' is used as input arg. Any suggestion ?

回答 (2 件)

Niraj Gadakari
Niraj Gadakari 2017 年 12 月 29 日
Please note that "inputname" function is used to display variable name of the function input.
Also, you cannot call "inputname" from the MATLAB command prompt or in a script you call from the command prompt.
Please refer to the this link for examples on using the "inputname" function

Maniraj M
Maniraj M 2018 年 1 月 8 日
Thanks for your interest. Are there any other way, we can grap what we supply as input for function?
For example, if my function name is 'myfunctionname', and I supply an object name as first input argument with additional argument as follows.
myfunctionname(myobjectnamexy(1),[1,5],data_date);
Will there be any option to grap exactly the phrase that we type as input. In the present case 'mybojectnamexy(1)'
May be some option which is not know to me. I guess nothing, otherwise your might have suggested !

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by