ft_replace_value_in_line.m
来自「用matlab做的Frequency domain INterferomEter」· M 代码 · 共 56 行
M
56 行
%--------------------------------------------------------------------- % function [outstring] = FT_replace_value_in_line(instring, position, value)% % Replaces one element in a string by a new value. The element% is indicated by the integer position%% instring: string, containing one line of text from a text file% position: integers, specifying which elements should% be places% value: double or string which will be inserted into string% outstring: string, containing new element%% Part of the SimTools package% Andreas Freise 22.05.08 afreise@googlemail.com%--------------------------------------------------------------------- function [outstring] = FT_replace_value_in_line(instring, position, value) % base string for error message id baseid='FT_replace_value_in_line'; if (iscell(instring)) instring=cell2mat(instring); end if (~isstr(instring)) msgid=[baseid,':checkinarg']; msg='first input argument must be a text line'; error(msgid,msg); end pos=int8(position); if(pos~=position) msgid=[baseid,':checkinarg']; msg='second input argument must be of type integer'; error(msgid,msg); end [element,estart,eend]=FT_get_element_from_line(instring, position); if (estart==1) str1=''; else str1=instring(1:estart); end if (isstr(value)) str2=value; else str2=num2str(value); end outstring=[str1,str2,instring(eend:length(instring))];
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?