tanya eror matrix

 
user image
more 8 years ago

diandewi

halo para master... bisa bantu benerin erornya dari code saya. erornya kyk gini: [DCC Error] Question19653Project1Unit1.pas(118): E2064 Left side cannot be assigned to. pada baris ini Ref[0][J] := Ref[0][J]+ alpha*(Ref[0][J]-Matrix[I,J]); for K := 0 to 1 do //for each reference begin Memo1.Lines.Add('Reference: '+IntToStr(K)); for I := 0 to 9 do //for each row begin X := 0; for J := 0 to 9 do //for each column X := X+Power(Ref[K,J]-Matrix[I,J], 2); X := Sqrt(X); EuclDist[K,I]:= X; Memo1.Lines.Add( Format('%0:20.18f',[X] )); end; Memo1.Lines.Add(''); end; //end; for I := 0 to 9 do begin if ((EuclDist[0][I]) < (EuclDist[1][I]))or ((EuclDist[0][I]) = (EuclDist[1][I])) then begin target:=0 ; for j:= 0 to 9 do if target=(matrix[i][j]) then begin Ref[0][J] := Ref[0][J]+ alpha*(Ref[0][J]-Matrix[I,J]); end else begin Ref[0][J] := Ref[0][J]- alpha*(Ref[0][J]-Matrix[I,J]); end; end;
user image
more 8 years ago

halimanh

Ref itu di deklarasinya sebagai constant yah? const ref [a, b] = array of ... Kalo const itu artinya tetap, nggak bisa dirubah. Kalo ref mau dirubah-rubah, didekarasikan sebagai variable var ref [a , b] : array of ...
user image
more 8 years ago

diandewi

oiya bener....setelah saya ubah jadi var langsung mau :) trus saya mau nanya lg satu di code ini for I := 0 to 9 do begin if ((EuclDist[0][I]) < (EuclDist[1][I]))or ((EuclDist[0][I]) = (EuclDist[1][I])) then begin target:=0 ; for j:= 0 to 9 do if target=(matrix[i][9]) then begin pas baris f target=(matrix[i][9]) then mksdnya jika target = matrix ke i kolom terakhir dimana matrixnya berukuran 10x10. apa bener kyk gt codenya? ato salah?
user image
more 8 years ago

halimanh

Yah tergantung indeksnya, kalo indeknya 0 sampe 9, berarti 9 itu kolom terakhir. Kalo indeknya 1 sampe 10, 10 itu kolom terakhir.
user image
more 8 years ago

diandewi

ya, indexnya 0 sampe 9 dan saya mau manggil kolom ke sembilan dari tiap2 baris..
more ...
  • Pages:
  • 1

Random Topic

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com