精華區beta MATLAB 關於我們 聯絡資訊
※ 引述《yimean (溫柔殺手N￾ ￾ ￾  )》之銘言: : If A is a n by n matrix. : As follows: : if "size(unique(a))==size(a)" is true, it means no duplicate elements in this : matrix.If this equation is false, it means there are some elements are : duplicate. : For your refrence. : If you have other nice idea, plesas share to us. Thank you very much. 有點問題 a:= matrix m*n size(unique(a)) 出來是一個 t 1 兩個值 (1<= t <=m*n) size(a) 出來是一個 m n 兩個值 基本上這兩個值 不管a怎麼輸入 都不會相等 比較這兩個值是否相等 跟元素有沒有重複沒有什麼關係 ex: a=[1 2 3;4 5 6;7 7 9]跟 a=[1 2 3;4 5 6;7 8 9] ans 都是0 0沒差異 我是想到 length(unique(a))==length(a(:)) 若值=0 ..有重複元素 若值=1 ..沒重複元素 也許matlab有內建函數吧 我不清楚 敬請指教@! -- 我的血液裏除了紅血球之外,剩下的都是 浪漫 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 211.74.178.165 ※ 編輯: DRAGONLL 來自: 140.120.7.110 (09/26 14:34)