How to assign a solution of a function into a cell in an array?

1 回表示 (過去 30 日間)
Ame Michael
Ame Michael 2018 年 4 月 26 日
コメント済み: Ameer Hamza 2018 年 4 月 26 日
I have made a function which will produce a word. I would like to produce a program which will take this word produced from the function, and put it into a cell array. How can this be achieved?
I have put:
dictionary{1}= the solution of the function is here
But then MATLAB says, Output argument "outputArg1" (and maybe others) not assigned during call to my function of interest.
To me the program makes sense, although it obviously is wrong somewhere. Any help would be greatly appreciated, thank you.

採用された回答

Ameer Hamza
Ameer Hamza 2018 年 4 月 26 日
編集済み: Ameer Hamza 2018 年 4 月 26 日
This is happening because your defined function is not returning the word. You need to assign the word to output variable to get its value by calling the function. See here for more details. You should define your function like this
function output = myFunction(inputs)
% do something which produce variable named 'word'
output = word;
end
  2 件のコメント
Ame Michael
Ame Michael 2018 年 4 月 26 日
Thank you very much for your help. I looked back at my function, and my assignments were precisely the problem.
Thank you, Ameer!
Ameer Hamza
Ameer Hamza 2018 年 4 月 26 日
You are Welcome.

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by