matlab doesnt allow me to import data in such format: 3322282802010072914:43:39:859 Is there any way I can import this kind of data in 33222828020100729144339859
Thanks

 채택된 답변

the cyclist
the cyclist 2011년 3월 22일

0 개 추천

Really trying to guess what you want, but maybe you could try using the "readtext" function from the file exchange. It reads files with mixed text and numeric reliably. I have found it useful.

추가 답변 (5개)

the cyclist
the cyclist 2011년 3월 22일

0 개 추천

How are the data stored, and how are you trying to retrieve them? You need to supply a lot more detail to get a good answer.
You could import the data as a string, and use the "strrep" command to get rid of the colons.
zheng
zheng 2011년 3월 22일

0 개 추천

I want to store all these numbers into a single cell. when I used the 'Import Data' these values become to Nan.
Matt Fig
Matt Fig 2011년 3월 22일

0 개 추천

You still have not answered all the cyclist's questions. Go back and read hist questions, then write detailed answers to them.
Matt Tearle
Matt Tearle 2011년 3월 22일

0 개 추천

You can use textscan to read arbitrarily formatted data from a text file. If you want to keep the values between the colons separate you could do something like:
data = textscan(fid,'%s:%f:%f:%f')
This will give you a 1-by-4 cell array, where each cell contains an array corresponding to the columns in the file; in this case the first "column" is 3322282802010072914, the second is 43, the third is 39, and the fourth is 859.
Alternatively, as the cyclist suggests, import as a single string, then strip out non-numeric characters. Again, using textscan you'll get a cell array of strings:
x = {'3322282802010072914:43:39:859';'8283812426456345234:12:45:222'}
regexprep(x,'\D','')
Note: no matter which way you go, you won't be able to represent this numerically -- 3322282802010072914 has too many digits to store as a double. That's why in both examples I've used a string.
zheng
zheng 2011년 3월 22일

0 개 추천

thank you so much for all of you

카테고리

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

태그

질문:

2011년 3월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by