フィルターのクリア

search pattern without using built -in function

1 回表示 (過去 30 日間)
Elysi Cochin
Elysi Cochin 2013 年 4 月 5 日
how to search pattern without using regexp or strcmp function.... that is if i have a word "mississippi" the string "issi" "ssi" "ss"..... occurs two times.... how to write it in code without using built-in function..... how to search whether a particular pattern is in the word and its occurance without using built-in function...... please do reply.....
  1 件のコメント
Daniel Shub
Daniel Shub 2013 年 4 月 5 日
What have you tried so far?

サインインしてコメントする。

採用された回答

Sean de Wolski
Sean de Wolski 2013 年 4 月 5 日
  1 件のコメント
Elysi Cochin
Elysi Cochin 2013 年 4 月 5 日
sir but regexp is a built-in function..... is it possible to do without any built-in function?? please do reply.....

サインインしてコメントする。

その他の回答 (1 件)

Jan
Jan 2013 年 4 月 5 日
Sorry, without built-in functions you cannot perform any useful operations in Matlab. Even the assignment using the "=" operator is a built-in function.
  6 件のコメント
Cedric
Cedric 2013 年 4 月 6 日
編集済み: Cedric 2013 年 4 月 6 日
The way you are using REGEXP makes it return an array of starting positions of the pattern in the array of characters that you are passing as a first argument.
You seem to have defined BWM as a rectangular array of characters, why? As Jan mention, should we understand that you have to find vertical occurrences or should we read BWM horizontally as if it were one long string? If such case, you could redefine it as
BWM = BWM(:).' ;
in order to make it easier for us to understand that it is just one long string and to simplify further processing
Now let's admit that it is just one long string, could you exploit a FOR loop like the following for searching the pattern?
for k = 1 : length(BWM)-length(expression)+1
% do something
end
If you have to "highlight" matches by framing them with stars, you could for example build a second BWM while you read the first, which would include the stars (might be easier than try to insert stars in the current version).
Elysi Cochin
Elysi Cochin 2013 年 4 月 8 日
thank u all

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeString Parsing についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by