How do I iterate a cell?
1 view (last 30 days)
Show older comments
Hello everyone,
I'm trying to code something in Matlab using the cogent toolbox to have a text box appear on the screen after subjects complete a portion of a particular task. This text box should cycle through the cell "warning.text" so that the first textbox says "none", the second "strong", the third "weak", and back to "none" etc.. ad infinitum. My code is found below; Matlab is showing an error on this line: "warning.text = {warning_state};".
What exactly can I do to fix my code?
%%Create Warning Screen
warning_state = 1
warning = expBuilder.TextBox();
warning.text = {'NONE','STRONG','WEAK'};
warning.text = {warning_state};
warning.fontSize = 30;
warning.width = 500;
warning.height = 40;
warning.frontColor = foreground;
[warning.elementBackColor, warning.backColor] = deal(background);
warning.make();
%%your thingy.text = text{... selector ...}
warning_state = warning_state + 1;
%%thingy.remake
% warning.remake();
%%thingy.draw(); or drawNow -> remove flip
warning.draw();
% drawnow;
%%wait ...
WARNING_TIMEOUT = 2000/SPEED
% wait(WARNING_TIMEOUT);
cgflip(background);
wait(WARNING_TIMEOUT);
1 Comment
Walter Roberson
on 24 May 2015
The above isn't really about MATLAB, it is about the Cogent toolbox. I do not know whether you are using Cogent Graphics or Cogent 2000. expBuilder.Toolbox is not coming up in other programs when I search; expBuilder seems to be some other toolkit, but I cannot tell which one as there are several with similar names none of which seem to contain TextBox
Answers (0)
See Also
Categories
Find more on String Parsing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!