作者bear32147 (dogbear)
看板MATLAB
標題[問題]function的input
時間Tue Mar 13 15:34:47 2012
我在撰寫函數時
將兩個矩陣當input丟入,並設定一個輸出
function Z_cal=Z_cal(RN,X)
卻出現error
Subscript indices must either be real positive integers or logicals.
輸入必須是正整數或邏輯
若把RN,X都設為正整數丟入
就可以執行
想問問怎麼解決
謝謝
補充一下 RN是1*6介於0~1的小數
X是2*20介於-5~+5的數
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.190.65
※ 編輯: bear32147 來自: 140.112.190.65 (03/13 15:38)
推 ejialan:輸出和function name重複 03/13 15:40
→ bear32147:謝謝 不過我修正後測試,還是出現一樣錯誤 03/13 15:48
→ ejialan:他的錯誤訊息是說矩陣的index要是正整數或是邏輯變數 03/13 15:57
→ ejialan:檢查看看矩陣index吧 03/13 15:57
→ bear32147:是指我前面將Xreshape過 index亂了嗎? 怎麼檢查 謝謝 03/13 16:23
→ bear32147:已解決 謝謝 ejialan 03/13 16:30