Separate the lottery evaluation and trial selection + other improvements - #113
Separate the lottery evaluation and trial selection + other improvements#113skim725 wants to merge 2 commits into
Conversation
|
|
||
| % want to pick a trial from each of the 4 types of blocks | ||
| % use getOneBlockPerCondition | ||
| getOneBlockPerCondition(data.blocks) |
There was a problem hiding this comment.
Either delete this line (as it merely prints one possible selection to stdout) or save it into a variable and use it in the for loop.
|
No way around it: this changes API for Prior to merge:
|
| @@ -0,0 +1,33 @@ | |||
| % Want a function which, given an input argument of the block number, | |||
| % returns the condition of that block (medical or monetary) and the block's | |||
There was a problem hiding this comment.
Sorry, just noticed this — this does not describe the function at all. (Or rather, it describes lines 23 and 24 of the function.)
| % Determine message to display | ||
|
|
||
| % For monetary gamble | ||
| if strcmp(config.runSetup.blockName, "Monetary") == 1 |
There was a problem hiding this comment.
This will not work on Matlab versions prior to 2016b be — don't ask me why, but Matlab was very strict that strings are denoted by apostrophes, not by quotes.
Also, note that this code doesn't create a basecase for a block whose name is neither monetary nor medical, which means that it will fail hard in those cases.
| conditions = subsetofblocs.conditions; | ||
|
|
||
| payoffKinds{blockIdx} = conditions.payoffKind; | ||
| beneficiaries{blockIdx} = conditions.beneficiary; |
There was a problem hiding this comment.
The way to generalize that for tasks with different kinds of conditions would be to a) poll fieldnames in block.conditions and make them into table headers, b) populate the table with the condition assignments extracted from each block. This is perfect for a vectorized approach -- in fact, cellfun(@(block) struct2table(block.conditions), blocks) would be a one-line expression of that logic (haven't checked).
Addresses #73.