Autor Beitrag
Ex0rzist
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 550

Win XP Prof.
Mandrake 10.0

D6
BeitragVerfasst: So 18.08.02 14:30 
Hallo,

gibt es einen Befehl, womit man alle Elemente einer Matrix gleich NULL setzen kann?

Ich habe das erstmal mit einer Schleife gelöst. Aber vielleicht geht das ja noch einfacher. :roll:

_____________

Ex0rzist
ao
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 145

Win XP Prof.
D7 Ent.
BeitragVerfasst: So 18.08.02 15:17 
Hallo ExOrzist,

wie genau sieht denn deine Matrix aus? Dynamisches Array?

Gruß
Andreas
Ex0rzist Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 550

Win XP Prof.
Mandrake 10.0

D6
BeitragVerfasst: So 18.08.02 15:27 
Hallo ao,

ja, es ist eine dynamische Matrix (zweidimensional) vom Typ:
ausblenden Quelltext
1:
2:
type
Matrix = Array of Array of Integer;


Ich habe es schon mit:
ausblenden Quelltext
1:
2:
3:
4:
5:
procedure ...
var Matr: Matrix;
begin
Matr := 0;   // ich dachte, damit würden alle Elemente angesprochen werden
end;


_________

Ex0rzist
ao
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 145

Win XP Prof.
D7 Ent.
BeitragVerfasst: So 18.08.02 15:47 
Hallo,

wenn ich dich richtig verstanden habe, willst du alle Felder deiner Matrix auf 0 setzen. Dafür gibt es soweit ich weiß keine Standard-Funktion oder Prozedur. Du müsstest also weiter mit Schleifen arbeiten. :? Ist das denn mit Schleifen zu langsam, oder suchst du einfach nach einer eleganteren Lösung?

Gruß
Andreas
Ex0rzist Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 550

Win XP Prof.
Mandrake 10.0

D6
BeitragVerfasst: So 18.08.02 15:52 
Hi,

zu langsam ist es nicht unbedingt. Ich halte meinen Code bloss lieber etwas kompakter. Das macht ihn übersichtlicher. :wink:

Aber naja, es ist nicht so schlimm, dass es sowas nicht gibt.

Gruß,
Ex0rzist
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: So 18.08.02 18:28 
Versuch es mal so:
ausblenden Quelltext
1:
FillChar (Matr, SizeOf (Matr), 0);					


Gruß
TINO
Ex0rzist Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 550

Win XP Prof.
Mandrake 10.0

D6
BeitragVerfasst: So 18.08.02 18:36 
Wenn ich es so mache, dann kommen bei mir Fehler.
Vielleicht liegt es daran, dass es ein zweidimensionales Array ist ... :?:

Auf jeden Fall haut das bei mir nicht hin. :?

_________

Ex0rzist