How to change the value of a vector through sub functions

3 ビュー (過去 30 日間)
Brian Peoples
Brian Peoples 2019 年 3 月 17 日
コメント済み: Walter Roberson 2019 年 3 月 17 日
Hello-
pretend:
prisoner = 1:2
outcomes = []
bias = .25
choice = zeros(1,2)
These are sub functions and I want to only change 1 element of the 'choice' vector eachtime the main function is called. How could this be done?
These are only a part of the subfunctions, but this is where I'm struggling..
%prisoner cooperate (1)
function [choice(1)] = prisoner_coop(prisoner,outcomes,bias)
choice(1) = 1
end
%prisoner defect (2)
function [choice(2)] = prisoner_defect(prisoner,outcomes,bias)
choice(2) = 0
end
  8 件のコメント
Walter Roberson
Walter Roberson 2019 年 3 月 17 日
What does your project have to do with transfer functions or embedded matlab functions ? You tagged a number of things that look irrelevant at the moment .

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by