AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Werte aus Spalten berechnen

Ein Thema von aaaaaaaaaa_10 · begonnen am 30. Jul 2009 · letzter Beitrag vom 30. Jul 2009
 
aaaaaaaaaa_10
(Gast)

n/a Beiträge
 
#1

Werte aus Spalten berechnen

  Alt 30. Jul 2009, 07:39
Hallo,
ich möchte aus einer Datei mit Spalten (s0,s1,...) Minimum, Maximum und Mittelwert der Spalte berechnen. Die Werte kommen aus dem StringArray[s,z]. Mini habe ich zu Beginn auf 1000000 gesetzt und temp auf 0. Nun dachte ich mir folgendes :

var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12 : string;
Delphi-Quellcode:
procedure TMomFiles.WerteBerechnen;
var temp1 : real;
    i : integer;
begin
    begin
      temp1 := StrToFloat(StringArray[s,z]);
    //Minimum
      while (temp1 < Mini) do
      Mini := temp1;
    //Maximum
      while (temp1 > Maxi) do
      Maxi := temp1;
    //Mittelwert
      testtemp := testtemp+temp1;
      Avr := (testtemp)/(z+1);
      case s of
        0 : s0 := FloatToStr(Mini)+#9+FloatToStr(Maxi)+#9+FloatToStr(Avr);
        1 : s1 := FloatToStr(Mini)+#9+FloatToStr(Maxi)+#9+FloatToStr(Avr);
        2 : s2 := FloatToStr(Mini)+#9+FloatToStr(Maxi)+#9+FloatToStr(Avr);
        3 : s3 := FloatToStr(Mini)+#9+FloatToStr(Maxi)+#9+FloatToStr(Avr);
        4 : s4 := FloatToStr(Mini)+#9+FloatToStr(Maxi)+#9+FloatToStr(Avr);
        5 : s5 := FloatToStr(Mini)+#9+FloatToStr(Maxi)+#9+FloatToStr(Avr);
        6 : s6 := FloatToStr(Mini)+#9+FloatToStr(Maxi)+#9+FloatToStr(Avr);
        7 : s7 := FloatToStr(Mini)+#9+FloatToStr(Maxi)+#9+FloatToStr(Avr);
        8 : s8 := FloatToStr(Mini)+#9+FloatToStr(Maxi)+#9+FloatToStr(Avr);
        9 : s9 := FloatToStr(Mini)+#9+FloatToStr(Maxi)+#9+FloatToStr(Avr);
        10 : s10 := FloatToStr(Mini)+#9+FloatToStr(Maxi)+#9+FloatToStr(Avr);
        11 : s11 := FloatToStr(Mini)+#9+FloatToStr(Maxi)+#9+FloatToStr(Avr);
        12 : s12 := FloatToStr(Mini)+#9+FloatToStr(Maxi)+#9+FloatToStr(Avr);
      end;
    end;
end;
Das Problem, im Moment vergleicht er alle Werte und nicht nur die Spaltenwerte miteinander und ich weiß nicht, wie ich das ummodeln kann. Ich kann/muss doch nicht für jede case Anweisung Minimum, MAximum und Mittelwert Code einfügen?!
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:27 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz