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
2
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 (3012) 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
comp.soft-sys.matlab 203195 articles. 525 followers. Post

9 Replies
1595 Views

Similar Articles

[PageSpeed] 40


  • 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 ...

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...

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...

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...

ecg data in .mat format
Hi, Can anyone pls share ecg data in .mat format. Thank you for your kind attention. ...

convert data into SAS format
Hi, all I have some data saved in Oracle database. I want to convert them into SAS format and saved them. Since the data set names have common character, like: abc_d_gghgh abc_d_iiuej abc_d_kkldld Does anyone has some easy way to convert all data set with file name as "abc_d_*"? Right now, I just manually input every file name by myself. Thank you very much! Jane Jane Easiest method to do this is: Assign a libname to your oracle DB Use proc copy with select statement using the 'starts with' structure. Example (untested) Libname fred Oracle use=xxx pass=xxx path=Orac...

Re: How to convert data format
Hi, Jane, It looks like this is what you had in mind: data inset; input id var1_1 var1_2 var2_1 var2_2 covar1 covar2; cards; 1 22 33 3 5 3 20 run; data set1; set inset; var1=3Dvar1_1; var2=3Dvar1_2; count=3D1; keep id count var1 var2 covar1 covar2; run; data set2; set inset; var1=3Dvar2_1; var2=3Dvar2_2; count=3D2; keep id count var1 var2 covar1 covar2; run; data mergeset; set set1 set2; run; proc print data=3Dmergeset; run; -Mary ----- Original Message -----=20 From: jn mao=20 To: SAS-L@LISTSERV.UGA.EDU=20 Sent: Monday, October 22, 2007 3:12 PM Subject:...

Re: How to convert data format #2
On Mon, 22 Oct 2007 15:56:32 -0500, Mary <mlhoward@AVALON.NET> wrote: >Hi, Jane, > >It looks like this is what you had in mind: > >data inset; > >input > >id var1_1 var1_2 var2_1 var2_2 covar1 covar2; > >cards; > >1 22 33 3 5 3 20 > >run; > >data set1; > >set inset; > >var1=var1_1; > >var2=var1_2; > >count=1; > >keep id count var1 var2 covar1 covar2; > >run; > >data set2; > >set inset; > >var1=var2_1; > >var2=var2_2; > >count=2; > >keep id count var1 var2 covar1 cov...

Convert data array to jmp format
Hi, I import data into Jmp that has a timestamp in this format: year,dayofyear,hourminute, for example: 2008,256,1145. I can't figure out a function in Jmp that will convert this to a recognizable form within Jmp. Is there one? Thanks, ak ...

ecg data in .mat format #2
Hi, Can anyone pls share ecg data in .mat format. Thank you for your kind attention. ...

How to convert data into libsvm format for classification
Thanks for your help first. I have correctly installed Libsvm. I am a newcomer in machine learning. I want to perform prediction with kernel function with large images. I want to know how to prepare data How should I convert this data into the libsvm format with REAL numbers represented? This is the first step to use libsvm. Thanks a lot. "Mohamed " <files@mathworks.com> wrote in message <j1rd32$hqh$1@newscl01ah.mathworks.com>... > Thanks for your help first. > I have correctly installed Libsvm. I am a newcomer in machine learning. > I want to perform...

convert the format of sas data sets
Hi, On our linux server, there are a bunch of SAS data sets created on AIX platform. So every time when we work with these data sets, we got the following message in the log, for example: ===================== NOTE: Data file IN.A1.DATA is in a format native to another host or the file encoding does not match the session encoding. Cross Environment Data Access will be used, which may require additional CPU resources and reduce performance. =================== Because these data sets are huge, we are concerned that "additional CPU resources and reduce performance" could be signifi...

how to plot graph from data in.txt format
Hi there, &nbsp; I want to ploat graph from taking data from txt file, i was using origin and out put of it also attached, The output of Labveiw came something different, i want to compare both, how can i ploat this text file in to the labview? &nbsp; In txt file:- fist column is showing time and second column showing appropriat data at that time. &nbsp; thanking you in advance dipen graph.zip: http://forums.ni.com/attachments/ni/170/296893/1/graph.zip Hi, The attached pic will help you solving your problem. ReadFile.PNG: http://forums.ni.com/attachments/ni/170/296902/1/ReadFi...