I want to change a name with a number in it to the number of the participant.

2 ビュー (過去 30 日間)
JamJan
JamJan 2018 年 5 月 22 日
コメント済み: JamJan 2018 年 5 月 22 日
Hello,
I want to give a number to a participant of my experiment. The number is in it's name, for example: Participant ='AG_1100 02_Porti_29'. The number of the participant is in bold, but I want Matlab to change it to 02 or just 2. So that the result is: Participant = 02.
How can I do this?
  2 件のコメント
Walter Roberson
Walter Roberson 2018 年 5 月 22 日
What is the rule about what number should be extracted? Is it always at the same offset in the character vector? Is it always the first 2 digits after the first blank? Is it always the first group of digits after the first blank, no matter how many digits that is?
JamJan
JamJan 2018 年 5 月 22 日
I have like 18 participants, so the number: 02 has to be extracted and is always on that place. There is no blank as you can see in the code.
Participant ='AG_110002_Porti_29'

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

採用された回答

Walter Roberson
Walter Roberson 2018 年 5 月 22 日
Participant = str2double(Participant(8:9));

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by