Is there any way to change an array output to display a word or phrase?

1 view (last 30 days)
I am simulating a random 4x1 array of 1s and -1s;

Accepted Answer

Adam
Adam on 9 Nov 2016
jStr = repmat( { 'Buy' }, numel( j ), 1 );
jStr( j == -1 ) = { 'Sell' };
I'm sure there are neater ways, but that should work.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!