Mercurial > repos > public > sbplib
comparison operator_def/read_stencil.m @ 821:95c26000c0ba feature/operator_files
Add files for parsing operator data stencil file
author | Ylva Rydin <ylva.rydin@telia.com> |
---|---|
date | Mon, 10 Sep 2018 16:57:17 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
820:501750fbbfdb | 821:95c26000c0ba |
---|---|
1 function [stencil_variables] = read_stencil(stencil) | |
2 fileID = fopen(stencil,'r'); | |
3 line = fgetl(fileID); | |
4 | |
5 | |
6 | |
7 while ~feof(fileID) | |
8 if isempty(line) | |
9 elseif strcmp(line(1),'#') | |
10 else | |
11 varname = genvarname(line); | |
12 val = []; | |
13 line = fgetl(fileID); | |
14 while ~isempty(str2num(line)) | |
15 val = [val; str2num(line)]; | |
16 line = fgets(fileID); | |
17 if line == -1 | |
18 break | |
19 end | |
20 end | |
21 stencil_variables.(varname) = val; | |
22 end | |
23 line = fgetl(fileID); | |
24 end | |
25 | |
26 end |