Need help looping through each element in cell array and editing the elements?

Hi,
I currently have a 10000 x 1 cell array, with each element corresponding to text that look like this: '5/13/2014 16:14,911,724 Biomarkers_neuron_ca_T05-13-14.csv'. I want to loop through each of these elements and delete all text before Biomarkers as well as the '.csv' to be left with elements: 'Biomarkers_neuron_ca_T05-13-14' and so on.
Appreciate the help!

 채택된 답변

str='5/13/2014 16:14,911,724 Biomarkers_neuron_ca_T05-13-14.csv'
out=regexpi(str,'\<Biomarkers.+','match')

댓글 수: 3

Thank you! however, I forgot to mention that the file names vary, and sometimes they are named something like: '5/13/2014 16:14,911,724 Untitled_neuron_ca_T05-13-14.csv'. Is there a way to generalize the code to apply it to this text.
str={'5/13/2014 16:14,911,724 Untitled_neuron_ca_T05-13-14.csv','5/13/2014 16:14,911,724 Biomarkers_neuron_ca_T05-13-14.csv'}
out=regexpi(str,'\<\S*.csv\>','match')
out{:}
I actually incorporated an if-statement to fix my issue, but your code is certainly more efficient. Thank you for your help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Cell Arrays에 대해 자세히 알아보기

질문:

2015년 8월 10일

댓글:

2015년 8월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by