Let say that I have a matrix A=[1 0 5 4; 2 0 5 4; 3 4 6 2]; and I am using the below code ( see my previews question Plot the numbers of a matrix as points (dots) in a plot) while any(A(:) > 0) [r,c] = find(A>0); X= randn; Y= randn; a=c+X b=r+Y A = A-1; end
it returns for a and b a =
1.4471 1.4471 1.4471 2.4471 3.4471 3.4471 3.4471 4.4471 4.4471 4.4471
b =
1.5364 2.5364 3.5364 3.5364 1.5364 2.5364 3.5364 1.5364 2.5364 3.5364
a =
0.6514 0.6514 1.6514 2.6514 2.6514 2.6514 3.6514 3.6514 3.6514
b =
3.1841 4.1841 4.1841 2.1841 3.1841 4.1841 2.1841 3.1841 4.1841
a =
1.2058 2.2058 3.2058 3.2058 3.2058 4.2058 4.2058
b =
3.1324 3.1324 1.1324 2.1324 3.1324 1.1324 2.1324
a =
1.4771 2.4771 2.4771 2.4771 3.4771 3.4771
b =
3.9398 1.9398 2.9398 3.9398 1.9398 2.9398
a =
1.6379 1.6379 1.6379
b =
0.2081 1.2081 2.2081
a =
3.6630
b =
3.5855
how can I have all the numbers of a and b in one vector respectively ?
Best Answer