Removes junk line 1 1
This commit is contained in:
parent
24a22681c8
commit
c7552aeceb
@ -41,9 +41,6 @@ char *file_name;
|
||||
|
||||
fp = fopen(file_name, "r");
|
||||
|
||||
/* read in junk line */
|
||||
fscanf(fp, "%*[^\n]\n");
|
||||
|
||||
fscanf(fp, "%d", &size);
|
||||
|
||||
ia = talloc(int, NDIMU(size+1));
|
||||
@ -92,9 +89,6 @@ char *file_name;
|
||||
|
||||
fp = fopen(file_name, "r");
|
||||
|
||||
/* read in junk line */
|
||||
fscanf(fp, "%*[^\n]\n");
|
||||
|
||||
fscanf(fp, "%d", &size);
|
||||
|
||||
data = talloc(double, NDIMU(size));
|
||||
|
||||
@ -4,17 +4,13 @@ function [v] = readvec(filename)
|
||||
% Reads from file 'filename' a vector v.
|
||||
%
|
||||
% Format:
|
||||
% First line is a dummy, two integers.
|
||||
% Next line is 'nv' the number of rows in matrix. Integer.
|
||||
% First line is 'nv' the number of rows in matrix. Integer.
|
||||
% Next 'nv' lines are the vector coefficients.
|
||||
%
|
||||
%-----------------------------------------------------------------------------
|
||||
|
||||
fid=fopen(filename,'r');
|
||||
|
||||
% read junk line
|
||||
junk = fscanf(fid,'%d',2);
|
||||
|
||||
nv = fscanf(fid,'%d',1); % number of variables (nv)
|
||||
[v, count] = fscanf(fid,'%le ',nv);
|
||||
fclose(fid);
|
||||
|
||||
@ -4,17 +4,13 @@ function [xy] = readxy(filename)
|
||||
% Reads from file 'filename' a set of xy pairs.
|
||||
%
|
||||
% Format:
|
||||
% First line is a dummy, two integers.
|
||||
% Next line is 'nv' the number of rows. Integer.
|
||||
% First line is 'nv' the number of rows. Integer.
|
||||
% Next 'nv' lines are the x(i), y(i) pairs.
|
||||
%
|
||||
%-----------------------------------------------------------------------------
|
||||
|
||||
fid=fopen(filename,'r');
|
||||
|
||||
% read junk line
|
||||
junk = fscanf(fid,'%d',2);
|
||||
|
||||
nv = fscanf(fid,'%d',1); % number of variables (nv)
|
||||
nv2=2*nv;
|
||||
[xy, count] = fscanf(fid,'%le %le',nv2);
|
||||
|
||||
@ -4,17 +4,13 @@ function [xyz] = readxyz(filename)
|
||||
% Reads from file 'filename' a set of xyz triplets.
|
||||
%
|
||||
% Format:
|
||||
% First line is a dummy, two integers.
|
||||
% Next line is 'nv' the number of rows. Integer.
|
||||
% First line is 'nv' the number of rows. Integer.
|
||||
% Next 'nv' lines are the x(i), y(i), z(i).
|
||||
%
|
||||
%-----------------------------------------------------------------------------
|
||||
|
||||
fid=fopen(filename,'r');
|
||||
|
||||
% read junk line
|
||||
junk = fscanf(fid,'%d',2);
|
||||
|
||||
nv = fscanf(fid,'%d',1); % number of variables (nv)
|
||||
nv3=3*nv;
|
||||
[xyz, count] = fscanf(fid,'%le %le %le',nv3);
|
||||
|
||||
@ -23,9 +23,6 @@ function [A,ia,ja,a] = readysmp(filename)
|
||||
|
||||
fid=fopen(filename,'r');
|
||||
|
||||
% read junk line
|
||||
junk = fscanf(fid,'%d',2);
|
||||
|
||||
nv = fscanf(fid,'%d',1); % number of variables (nv)
|
||||
[ia, count] = fscanf(fid,'%d ',nv+1);
|
||||
[ja, count] = fscanf(fid,'%d ',ia(nv+1)-1); % This is ja
|
||||
|
||||
@ -45,9 +45,6 @@ Matrix *matrix;
|
||||
|
||||
fp = fopen(file_name, "w");
|
||||
|
||||
/* write junk line */
|
||||
fprintf(fp, "1 1\n");
|
||||
|
||||
fprintf(fp, "%d\n", size);
|
||||
|
||||
for (j = 0; j < size+1; j++)
|
||||
@ -89,9 +86,6 @@ Vector *vector;
|
||||
|
||||
fp = fopen(file_name, "w");
|
||||
|
||||
/* write junk line */
|
||||
fprintf(fp, "1 1\n");
|
||||
|
||||
fprintf(fp, "%d\n", size);
|
||||
|
||||
for (j = 0; j < size; j++)
|
||||
|
||||
@ -4,13 +4,11 @@ function writevec(f,fname)
|
||||
% Writes vector f to filename
|
||||
%
|
||||
% Format:
|
||||
% First line is the dummy line '1 1'
|
||||
% Second line is 'nv', the length of the vector.
|
||||
% First line is 'nv', the length of the vector.
|
||||
% Next nv lines are the data
|
||||
%------------------------------------------------------
|
||||
nv = length(f);
|
||||
fid=fopen(fname,'w');
|
||||
fprintf(fid,'1 1\n'); % dummy row
|
||||
fprintf(fid,'%d\n',nv); % number of variables (nv)
|
||||
fprintf(fid,'%.15e\n',f);
|
||||
|
||||
|
||||
@ -4,13 +4,11 @@ function writexy(xy,fname)
|
||||
% Writes xy data to filename
|
||||
%
|
||||
% Format:
|
||||
% First line is the dummy line '1 1'
|
||||
% Second line is 'nv', the length of the vector.
|
||||
% First line is 'nv', the length of the vector.
|
||||
% Next nv lines are the data, x(i), y(i),
|
||||
%------------------------------------------------------
|
||||
[nv,nw]=size(xy);
|
||||
fid=fopen(fname,'w');
|
||||
fprintf(fid,'1 1\n'); % dummy row
|
||||
fprintf(fid,'%d\n',nv); % number of variables (nv)
|
||||
for j=1:nv,
|
||||
fprintf(fid,'%.15e %.15e\n',xy(j,1:2));
|
||||
|
||||
@ -4,13 +4,11 @@ function writexyz(xyz,fname)
|
||||
% Writes xyz data to filename
|
||||
%
|
||||
% Format:
|
||||
% First line is the dummy line '1 1'
|
||||
% Second line is 'nv', the length of the vector.
|
||||
% First line is 'nv', the length of the vector.
|
||||
% Next nv lines are the data, x(i), y(i), z(i)
|
||||
%------------------------------------------------------
|
||||
[nv,nw]=size(xyz);
|
||||
fid=fopen(fname,'w');
|
||||
fprintf(fid,'1 1\n'); % dummy row
|
||||
fprintf(fid,'%d\n',nv); % number of variables (nv)
|
||||
for j=1:nv,
|
||||
fprintf(fid,'%.15e %.15e %.15e\n',xyz(j,1:3));
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
function [nv,ia,ja,a] = writeysmp(filename,A,nv,ia,ja,a)
|
||||
% function [nv,ia,ja,a] = writeysmp(nv,ia,ja,a,filename)
|
||||
% function [nv,ia,ja,a] = writeysmp(filename,A,nv,ia,ja,a)
|
||||
%
|
||||
% writes ysmp file in 'filename' (no qualifiers added,
|
||||
% eg. not 'filename.ysmp')
|
||||
@ -14,7 +14,6 @@ end;
|
||||
outdat = [filename];
|
||||
fid=fopen(outdat,'w');
|
||||
|
||||
fprintf(fid,'1 1\n'); % dummy row
|
||||
fprintf(fid,'%d\n',nv); % number of variables (nv)
|
||||
fprintf(fid,'%d\n',ia);
|
||||
fprintf(fid,'%d\n',ja);
|
||||
|
||||
@ -41,9 +41,6 @@ char *file_name;
|
||||
|
||||
fp = fopen(file_name, "r");
|
||||
|
||||
/* read in junk line */
|
||||
fscanf(fp, "%*[^\n]\n");
|
||||
|
||||
fscanf(fp, "%d", &size);
|
||||
|
||||
ia = talloc(int, NDIMU(size+1));
|
||||
@ -92,9 +89,6 @@ char *file_name;
|
||||
|
||||
fp = fopen(file_name, "r");
|
||||
|
||||
/* read in junk line */
|
||||
fscanf(fp, "%*[^\n]\n");
|
||||
|
||||
fscanf(fp, "%d", &size);
|
||||
|
||||
data = talloc(double, NDIMU(size));
|
||||
|
||||
@ -4,17 +4,13 @@ function [v] = readvec(filename)
|
||||
% Reads from file 'filename' a vector v.
|
||||
%
|
||||
% Format:
|
||||
% First line is a dummy, two integers.
|
||||
% Next line is 'nv' the number of rows in matrix. Integer.
|
||||
% First line is 'nv' the number of rows in matrix. Integer.
|
||||
% Next 'nv' lines are the vector coefficients.
|
||||
%
|
||||
%-----------------------------------------------------------------------------
|
||||
|
||||
fid=fopen(filename,'r');
|
||||
|
||||
% read junk line
|
||||
junk = fscanf(fid,'%d',2);
|
||||
|
||||
nv = fscanf(fid,'%d',1); % number of variables (nv)
|
||||
[v, count] = fscanf(fid,'%le ',nv);
|
||||
fclose(fid);
|
||||
|
||||
@ -4,17 +4,13 @@ function [xy] = readxy(filename)
|
||||
% Reads from file 'filename' a set of xy pairs.
|
||||
%
|
||||
% Format:
|
||||
% First line is a dummy, two integers.
|
||||
% Next line is 'nv' the number of rows. Integer.
|
||||
% First line is 'nv' the number of rows. Integer.
|
||||
% Next 'nv' lines are the x(i), y(i) pairs.
|
||||
%
|
||||
%-----------------------------------------------------------------------------
|
||||
|
||||
fid=fopen(filename,'r');
|
||||
|
||||
% read junk line
|
||||
junk = fscanf(fid,'%d',2);
|
||||
|
||||
nv = fscanf(fid,'%d',1); % number of variables (nv)
|
||||
nv2=2*nv;
|
||||
[xy, count] = fscanf(fid,'%le %le',nv2);
|
||||
|
||||
@ -4,17 +4,13 @@ function [xyz] = readxyz(filename)
|
||||
% Reads from file 'filename' a set of xyz triplets.
|
||||
%
|
||||
% Format:
|
||||
% First line is a dummy, two integers.
|
||||
% Next line is 'nv' the number of rows. Integer.
|
||||
% First line is 'nv' the number of rows. Integer.
|
||||
% Next 'nv' lines are the x(i), y(i), z(i).
|
||||
%
|
||||
%-----------------------------------------------------------------------------
|
||||
|
||||
fid=fopen(filename,'r');
|
||||
|
||||
% read junk line
|
||||
junk = fscanf(fid,'%d',2);
|
||||
|
||||
nv = fscanf(fid,'%d',1); % number of variables (nv)
|
||||
nv3=3*nv;
|
||||
[xyz, count] = fscanf(fid,'%le %le %le',nv3);
|
||||
|
||||
@ -23,9 +23,6 @@ function [A,ia,ja,a] = readysmp(filename)
|
||||
|
||||
fid=fopen(filename,'r');
|
||||
|
||||
% read junk line
|
||||
junk = fscanf(fid,'%d',2);
|
||||
|
||||
nv = fscanf(fid,'%d',1); % number of variables (nv)
|
||||
[ia, count] = fscanf(fid,'%d ',nv+1);
|
||||
[ja, count] = fscanf(fid,'%d ',ia(nv+1)-1); % This is ja
|
||||
|
||||
@ -45,9 +45,6 @@ Matrix *matrix;
|
||||
|
||||
fp = fopen(file_name, "w");
|
||||
|
||||
/* write junk line */
|
||||
fprintf(fp, "1 1\n");
|
||||
|
||||
fprintf(fp, "%d\n", size);
|
||||
|
||||
for (j = 0; j < size+1; j++)
|
||||
@ -89,9 +86,6 @@ Vector *vector;
|
||||
|
||||
fp = fopen(file_name, "w");
|
||||
|
||||
/* write junk line */
|
||||
fprintf(fp, "1 1\n");
|
||||
|
||||
fprintf(fp, "%d\n", size);
|
||||
|
||||
for (j = 0; j < size; j++)
|
||||
|
||||
@ -4,13 +4,11 @@ function writevec(f,fname)
|
||||
% Writes vector f to filename
|
||||
%
|
||||
% Format:
|
||||
% First line is the dummy line '1 1'
|
||||
% Second line is 'nv', the length of the vector.
|
||||
% First line is 'nv', the length of the vector.
|
||||
% Next nv lines are the data
|
||||
%------------------------------------------------------
|
||||
nv = length(f);
|
||||
fid=fopen(fname,'w');
|
||||
fprintf(fid,'1 1\n'); % dummy row
|
||||
fprintf(fid,'%d\n',nv); % number of variables (nv)
|
||||
fprintf(fid,'%.15e\n',f);
|
||||
|
||||
|
||||
@ -4,13 +4,11 @@ function writexy(xy,fname)
|
||||
% Writes xy data to filename
|
||||
%
|
||||
% Format:
|
||||
% First line is the dummy line '1 1'
|
||||
% Second line is 'nv', the length of the vector.
|
||||
% First line is 'nv', the length of the vector.
|
||||
% Next nv lines are the data, x(i), y(i),
|
||||
%------------------------------------------------------
|
||||
[nv,nw]=size(xy);
|
||||
fid=fopen(fname,'w');
|
||||
fprintf(fid,'1 1\n'); % dummy row
|
||||
fprintf(fid,'%d\n',nv); % number of variables (nv)
|
||||
for j=1:nv,
|
||||
fprintf(fid,'%.15e %.15e\n',xy(j,1:2));
|
||||
|
||||
@ -4,13 +4,11 @@ function writexyz(xyz,fname)
|
||||
% Writes xyz data to filename
|
||||
%
|
||||
% Format:
|
||||
% First line is the dummy line '1 1'
|
||||
% Second line is 'nv', the length of the vector.
|
||||
% First line is 'nv', the length of the vector.
|
||||
% Next nv lines are the data, x(i), y(i), z(i)
|
||||
%------------------------------------------------------
|
||||
[nv,nw]=size(xyz);
|
||||
fid=fopen(fname,'w');
|
||||
fprintf(fid,'1 1\n'); % dummy row
|
||||
fprintf(fid,'%d\n',nv); % number of variables (nv)
|
||||
for j=1:nv,
|
||||
fprintf(fid,'%.15e %.15e %.15e\n',xyz(j,1:3));
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
function [nv,ia,ja,a] = writeysmp(filename,A,nv,ia,ja,a)
|
||||
% function [nv,ia,ja,a] = writeysmp(nv,ia,ja,a,filename)
|
||||
% function [nv,ia,ja,a] = writeysmp(filename,A,nv,ia,ja,a)
|
||||
%
|
||||
% writes ysmp file in 'filename' (no qualifiers added,
|
||||
% eg. not 'filename.ysmp')
|
||||
@ -14,7 +14,6 @@ end;
|
||||
outdat = [filename];
|
||||
fid=fopen(outdat,'w');
|
||||
|
||||
fprintf(fid,'1 1\n'); % dummy row
|
||||
fprintf(fid,'%d\n',nv); % number of variables (nv)
|
||||
fprintf(fid,'%d\n',ia);
|
||||
fprintf(fid,'%d\n',ja);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user