⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ft_replace_underscores.m

📁 用matlab做的Frequency domain INterferomEter Simulation SoftwarE,在国外网站下的,还在研究中,不会用,有会用的回复我
💻 M
字号:
%%--------------------------------------------------------------------------% function [outstring] = FT_replace_underscores(instring, new_char)%% A function for Matlab which replaces the underscores (_) in a string% by a given character.%% instring: input string% new_char: char or string that should be used to replace '_'% outstring: output string%% Charlotte Bond  18.07.2008%--------------------------------------------------------------------------%function [outstring] = FT_replace_underscores(instring, new_char)baseid='replace_underscores';if(~ischar(new_char))  msgid=[baseid,':checkinputargument'];  result='new_char must a chararcter or string';  error(msgid,result);end% Identify all underscore characters and replace them the new character.index=find(instring=='_');% if no '_' are found, return full stringif (isempty(index))  outstring=instring;elseif (length(new_char)==1)   % if new character is single char, use a simple replace  outstring=instring;  outstring(index)=new_char;else    % if '_' should be replaced by a string, we have to split and merge the instring  lidx=length(index);  lstr=length(instring);  if (index(1)==1)    outstring='';  else    outstring=instring(1:index(1)-1);  end  outstring=[outstring,new_char];    for i=2:lidx    outstring=[outstring,instring(index(i-1)+1:index(i)-1),new_char];  end    if (index(lidx)<lstr)    outstring=[outstring,instring(index(lidx)+1:lstr)];  endend        

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -