|
Re: How to read the data in a ".txt" document and store the data in a matri: msg#01190lib.opencv
I think this can help you. This code is used to read 0 and 1 from a file, you can modify it and get what you need. Regards, Luiz Reginaldo #include <iostream> #include <fstream> void loadFromFile( const char* nomeArquivo ) { ifstream file ; file.open( nomeArquivo ) ; // Grava os dados das listas de padroes e classes no arquivo while( !file.eof() ) { vector<double> padrao ; char umCaractere = (char) file.get() ; if( file.eof() ) break ; for( ; umCaractere == '0' || umCaractere == '1' ; umCaractere=file.get() ) { padrao.push_back( umCaractere == '0' ? 0 : 1 ) ; } } file.close() ; } Ñô ÕÔ <zhaoyang820520@xxxxxxxxxxxx> escreveu: I want to read the data in a ".txt" document and store the data in a matrix.The data in the ".txt" is stored row by row,and in a row,the data are separated by a comma.Can someone help me? Thank you very much! --------------------------------- ÑÅ»¢1GÃâ·ÑÓÊÏä°Ù·Ö°Ù·ÀÀ¬»øÐÅ ÑÅ»¢ÖúÊÖ-ËÑË÷¡¢É±¶¾¡¢·ÀɧÈÅ [Non-text portions of this message have been removed] Change settings: http://www.yahoogroups.com/mygroups, select Get Emails (get all posts) Daily Digest (one summary email per day) Read on the web (read posts on the web only)Or Unsubscribe by mailing OpenCV-unsubscribe@xxxxxxxxxxxxxxx SPONSORED LINKS Open source software Computer vision --------------------------------- YAHOO! GROUPS LINKS Visit your group "OpenCV" on the web. To unsubscribe from this group, send an email to: OpenCV-unsubscribe@xxxxxxxxxxxxxxx Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. --------------------------------- --------------------------------- Yahoo! Messenger com voz - Instale agora e faça ligações de graça. [Non-text portions of this message have been removed] Change settings: http://www.yahoogroups.com/mygroups, select Get Emails (get all posts) Daily Digest (one summary email per day) Read on the web (read posts on the web only)Or Unsubscribe by mailing OpenCV-unsubscribe@xxxxxxxxxxxxxxx |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Re: PCA - What next!?: 01190, Fadi Chakik |
|---|---|
| Next by Date: | How to access pixels - urgent question: 01190, evaspies |
| Previous by Thread: | Re: How to read the data in a ".txt" document and store the data in a matrix?i: 01190, Parameswaran |
| Next by Thread: | newbie running under windows xp, cxcore097.dll not found error: 01190, tshenry2001 |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |