How to copy elements of a matrix in an array Uniquely?
1 回表示 (過去 30 日間)
古いコメントを表示
Hello I am a student n i want to write a program which takes input as a matrix of any dimension and returns an array of its elements but they should be unique. element's appearance should be once only. I have written a small code but it is showing req output. The code is:
mat=rand(1,6) copy1(1)=mat(1) for i=2:length(mat) for j=1:length(copy1) if (mat(i)~=copy1(j)) copy1(i)=mat(i); else break; end
end
end
Kindly help....
@sh
0 件のコメント
採用された回答
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Specialized Power Systems についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!