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

1 Ansicht (letzte 30 Tage)
I am simulating a random 4x1 array of 1s and -1s;

Akzeptierte Antwort

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

Weitere Antworten (0)

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by