X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=utilities_ESRF%2Fheaderstring.m;fp=utilities_ESRF%2Fheaderstring.m;h=a7d708337ce896abbf579393f16bf22cd22e57a9;hb=99b9890c11d31f9ae22dd481873e01c708175073;hp=0000000000000000000000000000000000000000;hpb=d0401c49b6b7511cfdaa0534b78bd3c5b2b0637a;p=CreaPhase.git diff --git a/utilities_ESRF/headerstring.m b/utilities_ESRF/headerstring.m new file mode 100644 index 0000000..a7d7083 --- /dev/null +++ b/utilities_ESRF/headerstring.m @@ -0,0 +1,29 @@ +## function str=headerstring(what,value,kind) +## used by writeheader +## returns a string for incorporation in an edf-header +## what is the information item (e.g. 'Dim_1') +## value of the item +## kind is string, char, integer, logical, float or double +## origin: peter +## +## 30.09.2009 (HSu): Updated to work with double and char data types +## 2011-08-29 PC +## * add logical data type + +function str=headerstring(what,value,kind) + + str=[what ' = ']; + + switch kind + case {'string', 'char'}, + str=[str sprintf('%s ',value')]; + case {'integer', 'logical'}, + str=[str sprintf('%i ',value')]; + case {'float', 'double'} + str=[str sprintf('%g ',value')]; + otherwise + printf("Unknown data type in header %s\n",kind); + end + + str = [str sprintf(';\n')]; +end