How Convert TXT data format to MAT data format

  • Permalink
  • submit to reddit
  • Email
  • Follow


I have a EEG's data in txt format..
but now, i want to convert it to mat data format
can i do that?

this is because of Matlab can read more faster if the data i convert to MAT data format
3
Reply Putrisia 8/5/2010 3:26:04 AM

See related articles to this posting


Putrisia Hendra wrote:
> I have a EEG's data in txt format..
> but now, i want to convert it to mat data format
> can i do that?
> 
> this is because of Matlab can read more faster if the data i convert to 
> MAT data format

Although it would be theoretically possible to do the conversion outside 
of matlab, the amount of time it would take to write and debug the 
appropriate program would be completely unproductive. Just enter matlab 
and load the file; if you will need to load it again another time then 
it might be worth saving the contents as a MAT file.
0
Reply Walter 8/5/2010 4:29:23 AM

On Thursday, August 5, 2010 6:26:04 AM UTC+3, Putrisia Hendra  wrote:
> I have a EEG's data in txt format..
> but now, i want to convert it to mat data format
> can i do that?
> 
> this is because of Matlab can read more faster if the data i convert to MAT data format

0
Reply ayaleweliase (1) 12/10/2012 9:01:38 AM

hello Putrisia.

Im having the same problem.but im not convert the eeg text file to mat file.

how did you convert this?

I hope,you help me.Thank you so much.
0
Reply gorkemsvs (4) 12/26/2012 1:19:48 AM

I am trying to save .mat format.
But matlab have an error.
"Error using load
Unable to read MAT-file myeegdata.mat: not a binary
MAT-file.
Try LOAD -ASCII to read as text."

can u help me?
thank you.
0
Reply gorkemsvs (4) 12/26/2012 1:29:33 AM

On 12/25/2012 7:29 PM, gorkemsvs@gmail.com wrote:
> I am trying to save .mat format.
> But matlab have an error.
> "Error using load
> Unable to read MAT-file myeegdata.mat: not a binary
> MAT-file.
> Try LOAD -ASCII to read as text."
>

Well, clearly it isn't a recognizable .mat file.

Did you try Matlab's suggestion?

Was the file written from Matlab or is it just a stream file or some 
other format from some other source?

--

0
Reply none1568 (7455) 12/26/2012 1:47:15 AM

> Well, clearly it isn't a recognizable .mat file.
> 
> 
> 
> Did you try Matlab's suggestion?
> 
> 
> 
> Was the file written from Matlab or is it just a stream file or some 
> 
> other format from some other source?



My file is a text file.I opened the text file with matlab an i saved the file .mat format.But then i didn't open the .mat file in matlab.
My file contains numeric data.I guess I was an error saving the file.

sorry for my english thank you
0
Reply gorkemsvs (4) 12/26/2012 5:22:08 AM

On Wednesday, December 26, 2012 6:22:08 PM UTC+13, gork...@gmail.com wrote:
> > Well, clearly it isn't a recognizable .mat file.
> 
> > 
> 
> > 
> 
> > 
> 
> > Did you try Matlab's suggestion?
> 
> > 
> 
> > 
> 
> > 
> 
> > Was the file written from Matlab or is it just a stream file or some 
> 
> > 
> 
> > other format from some other source?
> 
> 
> 
> 
> 
> 
> 
> My file is a text file.I opened the text file with matlab an i saved the file .mat format.But then i didn't open the .mat file in matlab.
> 
> My file contains numeric data.I guess I was an error saving the file.
> 
> 
> 
> sorry for my english thank you

What do you mean when you say "I opened the text file..."?
Do you mean:
fid=fopen('myfile.txt','rt'):
If so, what did you do then?

Before you can save the data to a .mat file, you must read them into Matlab using something like textscan.
Then you can write them off to a .mat file using save.
0
Reply mulgor (3010) 12/26/2012 8:00:25 PM

Thanks for helping.



 fid =3D fopen('mydata.txt');
            C =3D textscan(fid, '%s%s%f32%d8%u%f%f%s%f');
            fclose(fid);


the code ,that you gave me which was wroten at the top of this sentence,is =
only used for matrixes which columns and lines are specific. but I have a l=
ot of matrixes which have different numbers of columns and lines in my text=
scan. So I need a code which can sense all different types of matrixes auto=
matic.

Thank you for all helping.

0
Reply gorkemsvs (4) 12/26/2012 10:20:43 PM

On 12/26/2012 4:20 PM, gorkemsvs@gmail.com wrote:
....

>              C = textscan(fid, '%s%s%f32%d8%u%f%f%s%f');
....

>
> the code ,that you gave me which was wroten [written] ...
> ... I have a lot of matrixes which have different numbers of
> columns and lines in my textscan. So I need a code which can sense all
> different types of matrixes automatic.
....

No can do if it's arbitrary unless you have additional 
information--either a header record in the file that identifies the file 
structure that can then be used or read a line and identify fields on a 
field-by-field basis before reading the rest of the file.

There's no magic elixir, sorry...

--
0
Reply none1568 (7455) 12/26/2012 10:53:15 PM

yes you can..

try this

s=fopen('file_nam.tax','r');
val=fscanf(s,'%f');
fclose(s);
save('mat_file_nam.mat','val');
0
Reply 2011eec11 10/25/2014 5:55:44 PM
comp.soft-sys.matlab 204202 articles. 544 followers. Post

10 Replies
1919 Views

Similar Articles

[PageSpeed] 27


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

How Convert TXT data format to MAT data format #2
I have a EEG's data in txt format.. but now, i want to convert it to mat data format can i do that? this is because of Matlab can read more faster if the data i convert to MAT data format ...

How Convert TXT data format to MAT data format #3
any one can help me do this???? On Aug 5, 3:51=A0pm, "Putrisia Hendra " <putrisiaza...@gmail.com> wrote: > any one =A0can help me do this???? Have you read the data from the .txt file into Matlab yet? If so, you can write them to a .mat file using save: save('MyEEGData') and retrieve them using load: load('MyEEGData') "Putrisia Hendra " <putrisiazahra@gmail.com> wrote in message <i3dcf8$ip$1@fred.mathworks.com>... > any one can help me do this???? i have try it.. it's done..! Thank You so Much.. On Thursd...

i want ot convert xml data format into the general data format
hi sir i have table hh .it has two columns one is hhno is integer datatype another hhdoc is xml data type like hh table hhno hhdoc ------------ --------------------------------------------------------------------------------- 100 <suresh>sfjfjfjfjf</suresh>.................................... 101 <ramesh>hhfhfhf</ramesh>.................................. how to convert the xml data format into the general data format pls help me with examples > how to convert the xml data format into the general data format pls > help ...

Data Entry Online, Data Format, Data Conversion and Data Entry Services through Data Entry Outsourcing
Now a day IT companies may needs to process rapidly growing amount of information. So it's becoming trends to outsource data entry work to reliable professional experts who gives excellent output with cost effective and time bound. Data Entry is the procedure of handling and processing over data. There are different forms of data entry like data entry for survey forms, legal services, entry for medical claim forms. Data for keeping track for credit and debit card transactions. Data entry can be differentiate in two forms online form data entry and offline data entry. Data Entry Online is...

Data Entry Online, Data Format, Data Conversion and Data Entry Services through Data Entry Outsourcing
Now a day IT companies may needs to process rapidly growing amount of information. So it's becoming trends to outsource data entry work to reliable professional experts who gives excellent output with cost effective and time bound. Data Entry is the procedure of handling and processing over data. There are different forms of data entry like data entry for survey forms, legal services, entry for medical claim forms. Data for keeping track for credit and debit card transactions. Data entry can be differentiate in two forms online form data entry and offline data entry. Data Entry Online is...

Data Entry Online, Data Format, Data Conversion and Data Entry Services through Data Entry Outsourcing
Now a day IT companies may needs to process rapidly growing amount of information. So it's becoming trends to outsource data entry work to reliable professional experts who gives excellent output with cost effective and time bound. Data Entry is the procedure of handling and processing over data. There are different forms of data entry like data entry for survey forms, legal services, entry for medical claim forms. Data for keeping track for credit and debit card transactions. Data entry can be differentiate in two forms online form data entry and offline data entry. Data Entry Online is...

Data Entry Online, Data Format, Data Conversion and Data Entry Services through Data Entry Outsourcing
Now a day IT companies may needs to process rapidly growing amount of information. So it's becoming trends to outsource data entry work to reliable professional experts who gives excellent output with cost effective and time bound. Data Entry is the procedure of handling and processing over data. There are different forms of data entry like data entry for survey forms, legal services, entry for medical claim forms. Data for keeping track for credit and debit card transactions. Data entry can be differentiate in two forms online form data entry and offline data entry. Data Ent...

Advantages of Data Conversion, Data Formats and Data Entry Services by Data Entry India
Now a day's paper has become outdated and organizations are using online services to avoid paper work. For any organization, its biggest and most important asset is its data and more important is perfect accessibility of that data when it is needed. Sometimes it becomes really very difficult to manage such a large amount of data, especially for firms with large amounts of information, multiple formats, and complex system requirements. In order to avoid such situations of mismanagement conversion services are like bliss. Conversion services allow these organizations to systematize their dat...

Re: convert data format for longitudinal data analysis with
Here's a DOW solution with temporary arrays that should do it in one pass. data have; input ID disease$ months; cards; 100 No . 101 Yes 3 101 Yes 5 103 No . 104 No . 105 Yes 1 105 Yes 3 105 Yes 6 ;run; data want(drop=_:); array temp_month {6} _temporary_; do _i_ = 1 by 1 until (last.id); set have; by id; if disease =: "Y" then temp_month[months] = months; end; do _n_=1 to 6; d...

Re: convert data format for longitudinal data analysis with #2
Sorry, just noticed we can do this with fewer variables data want; array temp_month {6} _temporary_; do until (last.id); set have; by id; if disease =: "Y" then temp_month[months] = months; end; do months = 1 to 6; disease = ifc(missing(temp_month[months]),"No","Yes"); temp_month[months] = .z; output; end; run; proc print;run; 2009/1/16 karma <dorjetarap@googlemail.com>: > Here's a DOW solution with temporary arrays that should do it in one pass. > > data have; > input ID disease$ mon...

Converting HTML input data to pre-format XML data
Hi All, I am really new to Ruby and here is my dilemma. I need to write a ruby-cgi (.rb) script that just spits back pre-formatted XML. Basically, my script would accomplish the following: a.) Read in your form variables (name-value pair). b.) Construct the right xml block. c.) Submit the XML to BaseCamp API. I have an interface to implement step c. However, as a start, I implemented "step a" (as shown below). It simply reads in my HTML-input fields (via submit from HTML-form to the script) and POST it to the server as "raw" text. #!c:\ruby\bin\ruby require "cgi&qu...

converting general date format data into short date format
hello, i am doing a date comparation and i have reallize that the data i have in my database (general date format) it is causing me problems, and because i don=B4t need the time data i would like to convert all the general date data into short date format, so i would like to delete the time part of the data, it is any way i can do that ???? Thank you in advance and sorry for my english carlos=20 converting general date format data into short date format to delete the "time" portion of a date/time value, you can use an Update query, as UPDATE TableName SET TableName.DateTimeFiel...

Re: convert data format for longitudinal data analysis with #5
On Fri, 16 Jan 2009 00:29:22 -0800, Newstat <chunyuanfei@GMAIL.COM> wrote: >We follow up the children from birth until 6 months, and the outcome >of interest is respiratory diseases. Now my data set looks like as >follows (simple version). > >ID disease age (months) (at which the disease occured) >100 No . >101 Yes 3 >101 Yes 5 >103 No . >104 No . >105 Yes 1 >105 Yes 3 >105 Yes ...

Re: convert data format for longitudinal data analysis with #4
Nice. I knew there was a classdata solution after you posted one a while ago for a similar problem, however the disease variable in this question threw me off using it. Really minor note: if 0 then set age;; should be if 0 then set test; 2009/1/16 ./ ADD NAME=Data _null_, <iebupdte@gmail.com>: > All of the information can be obtained from age. There is really no > need for the variable DISEASE. This method uses PROC SUMMARY to > EXPAND the data into 6 ages, the observation counter variable _FREQ_ > will contain a boolean for the former variable disease. You can > a...

Re: convert data format for longitudinal data analysis with #3
All of the information can be obtained from age. There is really no need for the variable DISEASE. This method uses PROC SUMMARY to EXPAND the data into 6 ages, the observation counter variable _FREQ_ will contain a boolean for the former variable disease. You can attach a value format is you like (value YN 1='Yes' 2='No';) data test; input (ID disease)(:$3.) age; cards; 100 No . 101 Yes 3 101 Yes 5 103 No . 104 No . 105 Yes 1 105 Yes 3 105 Yes 6 ;;;; run; data age; if 0 then set age; do age = 1 to 6; output; end; stop; run; proc summar...

convert data format for longitudinal data analysis with discrete responses
We follow up the children from birth until 6 months, and the outcome of interest is respiratory diseases. Now my data set looks like as follows (simple version). ID disease age (months) (at which the disease occured) 100 No . 101 Yes 3 101 Yes 5 103 No . 104 No . 105 Yes 1 105 Yes 3 105 Yes 6 ...... ...... ...... .... I want to create a new data set, with each row corresponding to one observation-month for one chi...

Data format for spherical data
Sorry if this posting appears twice. Also, this is not really an IDL question, though I will be using IDL to convert to the new data format. I've only worked only within the provincial field of astronomy, and so I've never had to deal with data formats other than FITS. But our data center is now being asked to make our all-sky data available in a more popular (but still scientific) data format, where suggestions so far for the new format have included NetCDF and GeoTIFF. The data will consist of various quantities (e.g. flux, error, # of observations) attached to ~60,000 lon...

Converting TXT-file data to the double array MAT-file data
Hi, I have a text file that has 544 entry information like this: "alpha-CH chemical shifts" (Andersen et al., 1992) A/L R/K N/M D/F C/P Q/S E/T G/W H/ Y I/V 4.35 4.38 4.75 4.76 4.65 4.37 4.29 3.97 4.63 3.95 4.17 4.36 4.52 4.66 4.44 4.50 4.35 4.70 4.60 3.95 // Here, A has 4.35 value, L has 4.17 value, R has 4.38, K has 4.36 an so on. Now, I want to convert this text file into the MAT file(double array or matrix). In this MAT file A,R,N,D,C,Q,E,G,H,I,L,K,M,F,P,S,T,W,Y,V should be the rows a...

formatting data in cell format
hello, i have an excel file that i'm trying to load into matlab. a simplified version looks like this: dog 7/23/08 3.2 dog 7/22/08 3.2 dog 7/21/08 4.5 cat 7/23/08 3.4 cat 7/22/08 2.2 cat 7/21/08 3.0 when i do xlsread, however, only the last column, the numbers, show up because those are in double format. the dates and animals are cells, and will not show up along with the numbers. my problem is, i'm trying to use matlab to format the data into: date dog cat 7/23/08 3.2 3.4 7/22/08 3.2 3.2 7/21/08 4.5 3.0 would there be ...

Data, data, data,
I have been tasked to dump around 400GB of data in physical files into a flat files and the transfer them from an iSeries 810 V5r3 to a windows server. I was going to CPYTOIMPF to a stram file and then copy over to the Windows server from the IFS. Anyone have a better idea or any suggestions? Thanks, Thad Rizzi Hi Thad If you have loads of free disk space on your 810 then your method is fine but if not you may consider Simply FTPing or iSeroes Access file transfering the files directly from the iSeries files to Windows Text file. You can get the either FTP or iSeries Access to carry out...

Advantages of Data Conversion and Data Formats Services by Data Entry India
Now a day's paper has become outdated and organizations are using online services to avoid paper work. For any organization, its biggest and most important asset is its data and more important is perfect accessibility of that data when it is needed. Sometimes it becomes really very difficult to manage such a large amount of data, especially for firms with large amounts of information, multiple formats, and complex system requirements. In order to avoid such situations of mismanagement conversion services are like bliss. Conversion services allow these organizations to systematize their dat...

Pls help
Hi, I have a text file that has 544 entry information like this: entry-1: A/L R/K N/M D/F C/P Q/S E/T G/W 4.35 4.38 4.75 4.76 4.65 4.37 4.29 3.97 4.17 4.36 4.52 4.66 4.44 4.50 4.35 4.70 Here, A has 4.35 value, L has 4.17 value, R has 4.38, K has 4.36 an so on. Now, I want to convert this text file into the MAT file(double array or matrix). In this MAT file A,R,N,D,C,Q,E,G,L,K,M,F,P,S,T,W should be the rows and the related values should be the columns. It's easy for one entry but my text file composed of 544 entries like...

Pls help
Hi, I have a text file that has 544 entry information like this: entry-1: A/L R/K N/M D/F C/P Q/S E/T G/W H/Y I/V 4.35 4.38 4.75 4.76 4.65 4.37 4.29 3.97 4.63 3.95 4.17 4.36 4.52 4.66 4.44 4.50 4.35 4.70 4.60 3.95 Here, A has 4.35 value, L has 4.17 value, R has 4.38, K has 4.36 an so on. Now, I want to convert this text file into the MAT file(double array or matrix). In this MAT file A,R,N,D,C,Q,E,G,H,I,L,K,M,F,P,S,T,W,Y,V should be the rows and the related values should be the columns. It's easy for one entry b...

How to convert data format
Hello SAS-Ls, I have a data set with repeated variables in each row. I need to do the longitudinal analysis. I wonder how I can convert the data to longitudinal format without lossing the covariate data. My original data format is: id var1_1 var1_2 var2_1 var2_1 covar1 covar2 1 22 33 3 5 3 20 var1_1 means the var1 at the 1st time point, var1_2 means var1 at the 2nd timepoint. Same thing as for var2. I need to convert it to below format, and add a new count variable: id count var1 var2 covar1 covar2 1 1 22 3...