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

조회 수: 2 (최근 30일)
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 CenterFile Exchange에서 Statistics 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