文字列の中から、”(”に対応した")"を探す
Show older comments
下記のような括弧を含む文字列があるとします。
文字列に含まれる"("に対応した")"が何文字目にあるかを調べたい場合、どのようにすれば良いでしょうか
text = "3*(A+(B+2))+5*(C+4)";
下記のように”(”が登場する位置と、対応する")"の位置を出力したいです。
ans =
3,11
6,10
15,19
Accepted Answer
More Answers (0)
Categories
Find more on 文字と文字列 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!