sandbox/acastillo/input_fields/output_matrix.m

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    
    function output_matrix(f,n,x,y,file)
    %output_matrix(f,n,x,y,'field-T-000000.bin'));
    % Allows to write as in output_fields() in BASILISK, where
    % the file has been stored as a single precision binary file.
    
    fileID = fopen(file,'w');
    
    fwrite(fileID,n,'single');
    
    for j = 1:n
    	fwrite(fileID,y(j),'single');
    end
    
    for i = 1:n
    	fwrite(fileID,x(i),'single');
    	for j = 1:n
    		fwrite(fileID,f(j,i),'single');
    	end
    end