How can I get numerical data from character array.

Hello everyone,
I would like to take numerical array from character array.The example of character array is following
if true
% code
filename(1)='test2 1234.csv';
filename(2)='test1111 3425.csv';
end
in this situation, how can i take the numerical array from filename(1) and (2)?
Thank you for reading.

댓글 수: 1

Maybe you meant to use a cell array?
filename{1}='test2 1234.csv';
filename{2}='test1111 3425.csv';
Also, what would be your desired output? I.e., what is the "numerical array" that you would take from the filenames?

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

답변 (1개)

Jan
Jan 2017년 12월 8일

1 개 추천

filename{2} = 'test1111 3425.csv';
num = sscanf(filename{2}, 'test%d %d.csv')

댓글 수: 1

Dear Jan Simon
Thanks for the mentoring. It really helped! And I will check 'Formatting Text'.
Best regards,
Kazuki

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

카테고리

도움말 센터 및 File Exchange에서 データ型の変換에 대해 자세히 알아보기

질문:

2017년 12월 8일

댓글:

2017년 12월 8일

Community Treasure Hunt

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

Start Hunting!