Mercurial > repos > public > sbplib
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/operator_def/read_stencil.m Mon Sep 10 16:57:17 2018 +0200 @@ -0,0 +1,26 @@ +function [stencil_variables] = read_stencil(stencil) +fileID = fopen(stencil,'r'); +line = fgetl(fileID); + + + +while ~feof(fileID) + if isempty(line) + elseif strcmp(line(1),'#') + else + varname = genvarname(line); + val = []; + line = fgetl(fileID); + while ~isempty(str2num(line)) + val = [val; str2num(line)]; + line = fgets(fileID); + if line == -1 + break + end + end + stencil_variables.(varname) = val; + end + line = fgetl(fileID); +end + +end \ No newline at end of file