about summary refs log tree commit diff
path: root/sourcecodes/parameter_learning/createJSON.m
diff options
context:
space:
mode:
authorziejd22021-02-24 14:36:59 -0600
committerziejd22021-02-24 14:36:59 -0600
commit25b843f6bbacb1937bdb960777b73acbece64115 (patch)
tree88645b9d1d8a0eea19d7229555bf8805571bc8b7 /sourcecodes/parameter_learning/createJSON.m
parent33cedf36248f616aa37d1462c69a4a3058a5d92e (diff)
downloadBNW-25b843f6bbacb1937bdb960777b73acbece64115.tar.gz
GENENET8 update
Diffstat (limited to 'sourcecodes/parameter_learning/createJSON.m')
-rw-r--r--sourcecodes/parameter_learning/createJSON.m13
1 files changed, 11 insertions, 2 deletions
diff --git a/sourcecodes/parameter_learning/createJSON.m b/sourcecodes/parameter_learning/createJSON.m
index 65758356..e6fd7ea2 100644
--- a/sourcecodes/parameter_learning/createJSON.m
+++ b/sourcecodes/parameter_learning/createJSON.m
@@ -12,6 +12,10 @@ function  [ ] = createJSON( pre )
    %
 
 
+nnodefile=strcat(pre,'nnode.txt');
+fnnode = fopen(nnodefile,'r');
+nnodes = fscanf(fnnode,'%d');
+
 %  open file for input, include error handling
 dfile=strcat(pre,'structure_input.txt');
 
@@ -22,7 +26,6 @@ end
 
 % Read in first line to get the number of nodes and the node labels.
 buffer = strtrim(fgetl(fin));    %get header line as a string
-nnodes = numel(strfind(buffer,"\t"))+1;
 labels = cell(1,nnodes);
 for j=1:nnodes
     [next,buffer] = strtok(buffer);
@@ -40,8 +43,14 @@ for i = 1:nnodes
 end
 
 
-% open file to read in model averaging scores
+
+%Check to see if a file with model averaging scores exists
 dfile2=strcat(pre,'structure_input_temp.txt');
+%if it does not exist, then just open the other structure file again
+if exist(dfile2, 'file') != 2
+   dfile2 = dfile;
+   frewind(dfile2);
+end
 
 fin2 = fopen(dfile2,'r');
 if fin2 < 0