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

1 visualizzazione (ultimi 30 giorni)
I am simulating a random 4x1 array of 1s and -1s;

Risposta accettata

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

Più risposte (0)

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by