看板 MATLAB 關於我們 聯絡資訊
你要的應該是這樣? for i = 1:6 for j = (i+1):6 eval(['compare', num2str(i), num2str(j), '= dist(A(', ... num2str(i), '), B(', num2str(j), ');']); end end ※ 引述《ccchain (陽光沙灘腳踏車~)》之銘言: : 各位高手,遇到ㄧ個問題, : For i=1:6 : For j=j+1:1:6 : Eval(['compare' num2str(i) num2str(j) '=' dist(A(i),B(j)]) : End : End : 2個問題: : 1。我是想顯示 compare12 這裡12是變數I j 產生 : 2。欲產生 1跟23456 : 2跟3456 : 3跟456 : 4跟56 : 5跟6 的結果 : J 試過很多算式,還是得不到要的答案。 : 小女子感恩了。 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.205.27.107 ※ 文章網址: https://www.ptt.cc/bbs/MATLAB/M.1437803074.A.39E.html
ccchain: 解決了,好感謝,感恩喔 07/25 14:54
※ 編輯: celestialgod (123.205.27.107), 07/25/2015 14:55:56