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

1 次查看(过去 30 天)
I am simulating a random 4x1 array of 1s and -1s;

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by