[問題] 關於MAX的問題已回收

看板MATLAB作者 (taurus)時間15年前 (2009/12/07 22:53), 編輯推噓4(401)
留言5則, 2人參與, 最新討論串1/2 (看更多)
for i=1:383 for j=1:238 loveTW_001(j,i)=max(I_c(j,i),I_d(j,i)); end end ------------ I_c和I_d分別為double的數字矩陣, 最後郤出現這個錯誤..XD ??? Undefined function or method 'loveTW_001' for input arguments of type 'double'. 可不可以跟小弟說一下問題在哪.. = = 謝謝囉..^^ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.116.134.173

12/07 23:03, , 1F
先在for前加 loveTW_001 = 0 看看
12/07 23:03, 1F

12/07 23:04, , 2F
你要不要附一下整段的code,我大概試一下,上面可以跑阿
12/07 23:04, 2F
整段..很長..麻煩看一下..謝謝..^^ 其實第一段到第三段都是重複的. --- %第一段 clear all; kk=imread('new56.jpg'); for i=0:383 for j=0:238 x(j+1,i+1)=kk(j+1,i+1,1); end; end; for i=0:381 for j=0:236 xx1=double(x(1+j,1+i)); xx2=double(x(1+j,2+i)); xx3=double(x(1+j,3+i)); xx4=double(x(2+j,1+i)); xx5=double(x(2+j,3+i)); xx6=double(x(3+j,1+i)); xx7=double(x(3+j,2+i)); xx8=double(x(3+j,3+i)); x1=(xx1+xx2+xx3+xx4+xx5+xx6+xx7+xx8)/8; t1=(xx1-x1)^4; t2=(xx2-x1)^4; t3=(xx3-x1)^4; t4=(xx4-x1)^4; t5=(xx5-x1)^4; t6=(xx6-x1)^4; t7=(xx7-x1)^4; t8=(xx8-x1)^4; x_red(2+j,2+i)=floor((double((t1+t2+t3+t4+t5+t6+t7+t8)/8))); end end image(x_red); ------- %第二段 kk=imread('new56.jpg'); for i=0:383 for j=0:238 x(j+1,i+1)=kk(j+1,i+1,2); end; end; for i=0:381 for j=0:236 xx1=double(x(1+j,1+i)); xx2=double(x(1+j,2+i)); xx3=double(x(1+j,3+i)); xx4=double(x(2+j,1+i)); xx5=double(x(2+j,3+i)); xx6=double(x(3+j,1+i)); xx7=double(x(3+j,2+i)); xx8=double(x(3+j,3+i)); x1=(xx1+xx2+xx3+xx4+xx5+xx6+xx7+xx8)/8; t1=(xx1-x1)^4; t2=(xx2-x1)^4; t3=(xx3-x1)^4; t4=(xx4-x1)^4; t5=(xx5-x1)^4; t6=(xx6-x1)^4; t7=(xx7-x1)^4; t8=(xx8-x1)^4; x_green(2+j,2+i)=floor((double((t1+t2+t3+t4+t5+t6+t7+t8)/8))); end end image(x_green); -------- %第三 kk=imread('new56.jpg'); for i=0:383 for j=0:238 x(j+1,i+1)=kk(j+1,i+1,3); end; end; for i=0:381 for j=0:236 xx1=double(x(1+j,1+i)); xx2=double(x(1+j,2+i)); xx3=double(x(1+j,3+i)); xx4=double(x(2+j,1+i)); xx5=double(x(2+j,3+i)); xx6=double(x(3+j,1+i)); xx7=double(x(3+j,2+i)); xx8=double(x(3+j,3+i)); x1=(xx1+xx2+xx3+xx4+xx5+xx6+xx7+xx8)/8; t1=(xx1-x1)^4; t2=(xx2-x1)^4; t3=(xx3-x1)^4; t4=(xx4-x1)^4; t5=(xx5-x1)^4; t6=(xx6-x1)^4; t7=(xx7-x1)^4; t8=(xx8-x1)^4; x_blue(2+j,2+i)=floor((double((t1+t2+t3+t4+t5+t6+t7+t8)/8))); end end image(x_blue); ------- 第四 for i=1:383 for j=1:238 t1_loveTW_001(j,i)=max(x_red(j,i),x_green(j,i)); t2_loveTW_001(j,i)=max(t_loveTW_001(j,i),x_blue(j,i)); %*[1;33m▓▓▓▓▓▓▓在這行會出現錯誤..XD▓▓▓▓▓▓▓▓▓▓*[m*[33m loveTW001(j,i)=min(255,floor(t1_loveTW_001(j,i)/1000)); end end image(loveTW001); ※ 編輯: nckutaurus 來自: 140.116.134.173 (12/08 00:01) ※ 編輯: nckutaurus 來自: 140.116.134.173 (12/08 00:08)

12/08 02:08, , 3F
這是同一個作業阿XD 上面的psw才問過類似的東西 囧
12/08 02:08, 3F

12/08 02:12, , 4F
同學....會出問題是因為你的t後面少了一個1
12/08 02:12, 4F

12/08 02:12, , 5F
還是你有另外的想法我就不曉得了.............XD
12/08 02:12, 5F
文章代碼(AID): #1B7HRyaQ (MATLAB)
文章代碼(AID): #1B7HRyaQ (MATLAB)