필터 지우기
필터 지우기

Cell to string

조회 수: 9 (최근 30일)
Fiboehh
Fiboehh 2011년 5월 28일
Hellow, i'm reading in data from an ascii file. And i get it with
Inputpara = textscan(fid,'%s',14,'delimiter','\n'); % Read strings delimited
Meapara = Inputpara{1};
Mvalues = cellfun(@(x)sscanf(x,'%f'),Meapara(5:end))
And now i can get the number out of Mvalues! But there are also string in it i want to use. Meapara exist of several strings like 'Stringvalue // value of string' Now i want to extract everything before the // . So i want a STRING! I tried everything but always error... that it is a cell and not a string... Please help me :)
  댓글 수: 2
Oleg Komarov
Oleg Komarov 2011년 5월 28일
Please post some lines of your input file and the desired output you want to attain.
Jan
Jan 2011년 5월 28일
If you show, what you have done and which error message appeared, we could suggest an improvement.

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

답변 (1개)

Walter Roberson
Walter Roberson 2011년 5월 29일
strings = regexp(Meapara,'^(.*?)//', 'tokens');
strings will now be a cell array of the parts before the // -- including any spacing (since you did say you want to extract everything before the //).

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by