create a 3x3 cell array with random numbers

hi, i have the follow variable mx = {randi(50,600,1); randi(360,60,1); randi(50,60,1)} this is a 3x1 cell array. I want to create a 3x3 cell array with random numbers. how can i do that?
thanks

 채택된 답변

Stephen23
Stephen23 2014년 12월 3일
편집: Stephen23 2014년 12월 3일

1 개 추천

I guess you don't mean scalar numerics, but rather numeric arrays of arbitrary size. I answered in a previous question of yours that you should consider working more with numeric arrays... these can be converted easily to cell arrays later.
For this question, as I also answered previously, one possibility is to create your numeric array and then use mat2cell to convert this into a cell array of numeric arrays. Something like this:
mat2cell(randi(50,20,10),[2,6,12],10)
In your example your three randi calls are over different ranges. Note that there is no possibility to create one numeric array using just one call to randi but with different ranges.

추가 답변 (1개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

AA
2014년 12월 2일

편집:

2014년 12월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by