diff options
Diffstat (limited to 'sourcecodes/parameter_learning/createJSON.m')
| -rw-r--r-- | sourcecodes/parameter_learning/createJSON.m | 13 |
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 |
