📄 ft_read_kat_constant.m
字号:
%--------------------------------------------------------------------- % function [value] = FT_read_kat_constant(block,constant_name)% % Reads the value of the given constant %% block: block structure % constant_name: string, name of the constant%% value: value of the constant (string or numerical value)%% Part of the SimTools package% Andreas Freise 17.06.08 afreise@googlemail.com%--------------------------------------------------------------------- function [value] = FT_read_kat_constant(block,constant_name) baseid='FT_read_kat_constant'; if (~isstruct(block)) msgid=[baseid,':checkinarg']; result='first input argument must be a block structure'; error(msgid,result); end if (~isstr(constant_name)) msgid=[baseid,':checkinarg']; result='second input argument must be a string'; error(msgid,result); end bl=length(block); if (bl>1) msgid=[baseid,':checksize']; error(msgid,'first argument must be single FTblock'); end lines=[]; tmp_lines=FT_find_element_in_active_block(block,2,constant_name); % check whether we really found the constant for i=1:length(tmp_lines) [element,estart,eend]=FT_get_element_from_line(block.txt_lines(tmp_lines(i)),1); if (strcmp(element,'const')) lines=[lines,tmp_lines(i)]; end end if (length(lines)<1) msgid=[baseid,':find_constant']; error(msgid,'could not find named constant'); end if (length(lines)>1) msgid=[baseid,':find_constant']; error(msgid,'found two instances of named constant'); end % getting constant value value=cell2mat(FT_parse_line(block.txt_lines(lines),3));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -