.. highlightlang:: us .. index:: format .. _format: format ====== .. us.tag format GERMAN ``format`` setzt das Ausgabe-Format für die :ref:`print`-Anweisung. .. function:: bool = format() bool = format(ssFormat) bool = format(rsSplitWidth) bool = format(rsFieldWidth, rsPrecision) .. us.return **Returnwert** *bool* ist TRUE (1), wenn die Funktion erfolgreich war und FALSE (0) bei Auftreten eines Fehlers. .. us.params **Parameter** .. uparam:: ssFormat *ssFormat* kann einer der folgenden Strings sein: .. list-table:: :header-rows: 1 * - Wert - Bedeutung * - ``"e"`` - (siehe Beispiel) * - ``"E"`` - (siehe Beispiel) * - ``"g"`` - (siehe Beispiel) * - ``"f"`` - (Defaultwert) * - ``"+"`` - (siehe Beispiel) * - ``"-"`` - (siehe Beispiel) .. uparam:: rsSplitWidth *rsSplitWidth* (default ist -1) .. uparam:: rsFieldWidth *rsFieldWidth* (siehe Beispiel) .. uparam:: rsPrecision *rsPrecision* (default ist 10, 4) .. us.comment **Kommentar** Wird :ref:`format` ohne Parameter aufgerufen, werden alle Einstellungen auf Default-Werte gesetzt. .. us.example **Beispiel** :: * a = rand(1,10) * a 0.0370 0.2906 0.0861 0.7476 0.3594 0.2081 0.0798 0.1479 0.7082 0.3954 * format(60) 1.0000 * a Spalten 1 bis 5 0.0370 0.2906 0.0861 0.7476 0.3594 Spalten 6 bis 10 0.2081 0.0798 0.1479 0.7082 0.3954 * format("+") + * a ++++++++++ * a[4] = 0 * a +++ ++++++ * format("-") + * a +++-++++++ * format("e") 1.0000e+000 * a Spalten 1 bis 5 3.7013e-002 2.9060e-001 8.6077e-002 0.0000e+000 3.5945e-001 Spalten 6 bis 10 2.0813e-001 7.9766e-002 1.4793e-001 7.0816e-001 3.9545e-001 * format("g") 1 * a Spalten 1 bis 5 0.03701 0.2906 0.08608 0 0.3594 Spalten 6 bis 10 0.2081 0.07977 0.1479 0.7082 0.3954 * format("f") 1 * format(5, 1) 1.0 * a Spalten 1 bis 10 0.0 0.3 0.1 0.0 0.4 0.2 0.1 0.1 0.7 0.4 * format() 1.0000. .. seealso:: :ref:`uberblick-programmierung`, :ref:`print` :sub:`id-454281`