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

📄 extract_words.m

📁 基于Matlab的地震数据处理显示和测井数据显示于处理的小程序
💻 M
字号:
function words=extract_words(string)% Function extracts character groups from input character string "string" and stores% them in a cell array; character groups must start with a letter and can contain numbers and% underscores.% Written by: E. R.: Date March 4, 2000;% Last updated: December 7, 2000: words must satisfy the same rules as MATLAB variables% INPUT % string	String to be analyzed% OUTPUT% words         Cell array containing all contiguous groups of letters including underscores%            words=extract_words(string)idx=(isletter(string) | string == '_' | (double(string) > 47 & double(string) < 58));didx=diff([0,idx,0]);index=find(didx ~= 0);nw=length(index);if nw == 0  words=cell(0);else  for ii=1:2:nw    words((ii+1)/2)={string(index(ii):index(ii+1)-1)};  endend%       Eliminate words that start with a numbercount=0;% keyboardfor ii=1:length(words);  if isletter(words{ii}(1))    count=count+1;    words(count)=words(ii);  endendwords(count+1:length(words))=[]; 

⌨️ 快捷键说明

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