Create a matrix whereas values can be -180 0 or 200
显示 更早的评论
Hello
Is like the title says: i would be able to create a certain matrix 1:24 where i can only have -180, 0 or 200 sort randomly.
P.E.
[-180 200 0 0 0 200 200 -180 -180 0 ....]
Thanks in advance
采纳的回答
更多回答(1 个)
Image Analyst
2012-12-18
Try this:
a = int16(randi(3, 1, 24))
a(a==1) = -180;
a(a==2) = -0;
a(a==3) = -200;
1 个评论
Image Analyst
2012-12-18
For a more general solution you can use intlut(), in the Image Processing Toolbox.
类别
在 帮助中心 和 File Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!