Info
此问题已关闭。 请重新打开它进行编辑或回答。
Could anyone help me to solve the following issue.
1 次查看(过去 30 天)
显示 更早的评论
I am trying from today morning but unable to get the desired result.
I am having matrix
a =[ 4.7908 5.0104 5.1329 5.3186 5.3094 5.3070 5.4452 5.5001;
0.0958 0.0994 0 0 0.1848 0.2020 0.1851 0.2146;
0.0848 0 0.1469 0.1859 0.1767 0.1854 0.1856 0.1648;
0 0 0 0 0 0 0 0;
0 0.0896 0.1619 0.1351 0 0 0 0;
0 0 0 0 0 0 0 0]
With respect to this matrix i want to change the place of elements randomly present in each column of matrix.
For example,the first column can be arranged as [4.7908;
0;
0.0848;
0;
0.0958;
0] % the place of elements got changed with respect to first column itself.
Inorder to perform this i tried with the following code
for i=1:size(a,2)
iwant = reshape(a(randperm(numel(a))),size(a))
end
Now when coming to the second column,the elements needs to be changed with respect to the second column itself without affecting the first column.
But in my code when the loop comes for the secong column it affects the first column also.
Could anyone please help me on this
3 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!