Trying to get things to work, however my second function now gives an error. Do I need to make matrix1 a global variable to make the function assets work? As well as procedure seems to not work if i put a command line around the second function. Sorry to bother you with these basic questions :s thank you for helping.
program oplossing;
// Student naam: TYP JE NAAM HIER
// Student nummer: s0123456
// CheckMagicSquare
{$mode objfpc}{$H+}
{$APPTYPE CONSOLE}
uses
Classes, SysUtils, KUMatrixGeneric;
function change(matrix2: TKUStringMatrix): TKUStringMatrix;
var matrix1: TKURealMatrix;
var i,j: Integer;
begin
matrix1 := TKURealMatrix.Create(matrix2.NrRows, matrix2.NrCols);
for i := 1 to matrix1.NrRows do
for j := 1 to matrix1.NrCols do
if matrix2.Cell[i, j] <> '' then
matrix1.Cell[i, j] := StrToFloat(matrix2.Cell[i, j]);
end
function assets(matrix1: TKURealMatrix): TKURealMatrix;
var i, j, k : Integer;
begin
i:=0;
k:=1;
for i:=1 to 50 do //119533
begin
for j:=k to matrix1.NrRows do
begin
if matrix1[i,1] = matrix1[j,1] then // gck the same
begin
if matrix1[j,2] = matrix1[i,2] - 1 then
begin
writeln('Does it work?');
matrix1.SetCell(i,4,matrix1[j,3]);
k:=j;
end
else break;
end
end;
end;
if i= 40 then
writeln('40');
//if i=100 then
// writeln('100');
if i= 50000 then
writeln('halfweg');
if i= 85000 then
writeln('bijna daar');
matrix1.Save('Compustat v009.txt');
writeln('file saved');
end;
procedure LinkdProc();
//import gegevens
var matrix2: TKUStringMatrix;
var matrix1: TKURealMatrix;
begin
matrix2 := TKUStringMatrix.Create('Compustat v008.csv',';');
matrix2.showshort();
writeln();
//matrix2.show();
writeln('Import bestanden gelukt');
change(matrix2);
assets(matrix1);
Readln;
end;
begin
LinkdProc();
end.