f



Need help reading data from a .txt file

Hello,

I am trying to average a value from a column in a .txt file I have.  It has a LOT of data (values for 20 different variables every 50 ms or so for a 90 second trial) and I need to specify the time points when one of these variables should be averaged. I am interested in this value's change when a stimulus is presented and of course the stimulus is only presented at certain time frames of these 90 seconds. So basically, after I have calculated the time frames in which I'm interested, how do I let matlab know to calculate the average value of that one variable during those specific time frame (say, value X's average from 20000 ms to 22500 ms)? 

Timepoint and value X each have their own column by the way, in case that wasn't clear

If anyone can suggest how I should go about this please let me know!
0
7/27/2009 8:09:02 PM
comp.soft-sys.matlab 211266 articles. 23 followers. lunamoonmoon (257) is leader. Post Follow

2 Replies
504 Views

Similar Articles

[PageSpeed] 9

Hi,
I would suggest that you load this field (or the whole file and then the particular field) in a MATLAB variable and then simply write a for loop to calculate mean/average on timeframe of 90secs.


"David " <david.munoz@duke.edu> wrote in message <h4l1gu$hqq$1@fred.mathworks.com>...
> Hello,
> 
> I am trying to average a value from a column in a .txt file I have.  It has a LOT of data (values for 20 different variables every 50 ms or so for a 90 second trial) and I need to specify the time points when one of these variables should be averaged. I am interested in this value's change when a stimulus is presented and of course the stimulus is only presented at certain time frames of these 90 seconds. So basically, after I have calculated the time frames in which I'm interested, how do I let matlab know to calculate the average value of that one variable during those specific time frame (say, value X's average from 20000 ms to 22500 ms)? 
> 
> Timepoint and value X each have their own column by the way, in case that wasn't clear
> 
> If anyone can suggest how I should go about this please let me know!
0
ea39 (35)
7/27/2009 8:58:02 PM
Sorry if I didn't make it clear, but what you suggested is how far I already am. I guess I didn't specify enough unfortunately, though I appreciate that you took the time to respond to my post. The problem I'm having is  how to calculate the means for the specified times. 

Here's the script I have, hopefully this helps you see my problem. t is the trial number, and starttime and endtime are being read and defined earlier in the script from a matfile. Keep in mind I'm new to matlab so I might be missing something fairly obvious... any feedback would be appreciated!

"for s= 1:nsubj   
       fname = sprintf('RGData\\%sbCMD.txt',subj);
       fid = fopen(fname,'r');   
    for t=1:10
        times = textscan(fid,'%f\t%f\n');
        fclose(fid);  "

This opens each subject's file and makes a "times" variable that contains the timepoints in the first column and dilation in the second column but I'm confused as to how to average a specific time frame given a set start and endpoint. Another problem is that the start and endpoint are given in seconds in the mat file. The time column in the txt file is listed in milliseconds, every 20 milliseconds starting at 0. Any thoughts or ideas would be greatly appreciated!

"   while starttime(t)<=times(1)<=endtime(t)
       y= sum(times,1)
       dilation(t)= y(2)/length(endtime(t)-starttime(t))"

end
end
end

Thanks again


"Elangovan " <ea39@njit.edu> wrote in message <h4l4cq$jf4$1@fred.mathworks.com>...
> Hi,
> I would suggest that you load this field (or the whole file and then the particular field) in a MATLAB variable and then simply write a for loop to calculate mean/average on timeframe of 90secs.
> 
> 
> "David " <david.munoz@duke.edu> wrote in message <h4l1gu$hqq$1@fred.mathworks.com>...
> > Hello,
> > 
> > I am trying to average a value from a column in a .txt file I have.  It has a LOT of data (values for 20 different variables every 50 ms or so for a 90 second trial) and I need to specify the time points when one of these variables should be averaged. I am interested in this value's change when a stimulus is presented and of course the stimulus is only presented at certain time frames of these 90 seconds. So basically, after I have calculated the time frames in which I'm interested, how do I let matlab know to calculate the average value of that one variable during those specific time frame (say, value X's average from 20000 ms to 22500 ms)? 
> > 
> > Timepoint and value X each have their own column by the way, in case that wasn't clear
> > 
> > If anyone can suggest how I should go about this please let me know!
0
7/29/2009 8:07:01 PM
Reply:

Similar Artilces:

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 but my text file composed of 544 entries like this. Is there any MatLab code(M-file) to make it? It's urgent, pls help me. Sincerely... Chiemera <muratgok@gmail.com> wrote in message <5031e376-0389-4c66-be4d-56f16eabefb5@26g2000yqk.googlegroups.com>... > 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 sho...

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 this. Is there any MatLab code(M-file) to make it? It's urgent, pls help me. Sincerely... Chiemera <muratgok@gmail.com> wrote in message <555bdde7-720f-4e7a-a77b-63f8c8d11b70@o15g2000yqm.googlegroups.com>... > 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 > this. Is...

Write table data into flat file(.csv,.txt) and again read it from flat file(.csv,.txt)
Hi database Community, I have following specification with me 1>New Database(9.2) at place A 2>Old Database(9.2) at place B Now i want to transfer table data at Place A into flat file(.csv,.txt etc.) And again re read flat file data and put it into table at place B In short i want write data into flat file and read data from flat file. Could anyone tell me what is better way to achieve this. I am Beginner (practice purpose) If possible give some link for downloading the tutorial Thanking in advance Sanjeev N.A. "sanjeev" <sanjeev_atvankar@yahoo.co.in> a �crit dans le message de news: 1162014097.876584.128470@f16g2000cwb.googlegroups.com... | Hi database Community, | | I have following specification with me | 1>New Database(9.2) at place A | 2>Old Database(9.2) at place B | | Now i want to transfer table data at Place A into flat file(.csv,.txt | etc.) | | And again re read flat file data and put it into table at place B | | In short i want write data into flat file and read data from flat file. | | | Could anyone tell me what is better way to achieve this. | I am Beginner (practice purpose) If possible give some link for | downloading the tutorial | | | Thanking in advance | Sanjeev N.A. | Unloader: http://asktom.oracle.com/~tkyte/flat/index.html SQL*Loader: http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96652/ch03.htm#1656 You can also use exp/imp: http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96652/part...

Problem with compiled matlab program; not reading and writing from .txt data files unless it's launched from command prompt
My compiled matlab program is not reading and writing txt files properly (although the .m file version behaves fine). I'm using low level read/write functions like fprintf, fscanf, textscan, and fgetl. Also, the compiled version works fine if i launch it through a command prompt rather than double clicking the executable. I'm using matlab 2010b and windows vista. Any idea what the nature of the problem could be? Thanks! Edit- my program is quite massive and i've not been able to isolate the portions that are failing. The program is intended to read some data from a .txt file every .5 seconds and plot it in a gui, and this works fine in the .m file version of the program, but the compiled version just doesn't plot any data, and also never creates directories in which the data is stored. However, if i launch the compiled program from a command prompt it behaves the same way it does in ordinary matlab code. Could this be an issue with environment variables?? jerad "J Fields" <jaf457@removemenyu.com> wrote in message news:iucvek$fs6$1@newscl01ah.mathworks.com... > My compiled matlab program is not reading and writing txt files properly > (although the .m file version behaves fine). I'm using low level > read/write functions like fprintf, fscanf, textscan, and fgetl. > > Also, the compiled version works fine if i launch it through a command > prompt rather than double clicking the executable. > > I'm using...

I need the detail about how to read the data from spreadsheet file. but the file should not created by labview.
i face some difficulties here. the datas are encrypted...... how to get correct data .......... Well, what do you know about the "encryption"? Who encrypted it? Can you open it in any other application? &nbsp; (Could it be you are trying to&nbsp;read an *.xls file created by micorsoft excel using "read from spreadsheet file"?) Actually i created a excel file".xls"(not by using Labview) and then i tried to read that file by using "read spreadsheet file "function. but the output is the array of datas. but datas are not as string... it seems like encrypted...but i need the output like array of string( that means what i entered in excel sheet) Excel files are in a propriertary microsoft format. A LabVIEW "spreadsheet" file is a file containing an ASCII table with tabs separating columns and linefeeds separating rows. They are not ther same! :) &nbsp; If you use "write to spreadsheet file" and name the file *.xls, this does NOT make it an excel file, it just tells the operating system to open it with excel if you double-click it. Excel is smart enough to notice that it is not really an excel file and does its best to convert it transparently. The same does not work in reverse. &nbsp; You have several options: - You can use excel to export your data to something LabVIEW can read. Try e.g. tab delimited text. - You can use e.g. activeX to read an excel file, see: <a href="http://zone.ni.com/devz...

Reading data from .txt file
Hi all We have got the data from logic analyzer using gpib interface and saved them with abc.txt file The contents of abc.txt are as below. &k0SMACHINE 1 - State Listing Label > Lab1 __________ ____ Base > Deci 0 0512 1 0608 2 0512 3 0160 4 0512 5 0128 6 0512 7 0000 8 0512 9 0160 10 0512 11 0512 12 0512 13 0128 14 0512 15 0000 16 0512 17 0512 18 0512 19 0512 20 0512 21 0160 22 0512 23 0512 24 0512 25 0512 26 0512 27 0608 28 0512 29 0608 30 0608 31 0512 32 0512 33 0000 34 0512 35 0512 36 0512 37 0512 38 0512 39 0608 40 0512 41 0512 42 0000 43 0228 44 0512 45 0512Time Printed: 16 Nov 2009 21:02:19 --- Time Acquired: 16 Nov 2009 20:53:39 What we are trying to do is processing data of only numeric data, so we want to remove all the strings. So that the data to be like 0 0512 1 0608 .... Is there anyone who can help us? On 16 Nov, 14:44, "Kangil Cho" <joga...@sogang.ac.kr> wrote: > Hi all > > We have got the data from logic analyzer using gpib interface and saved t= hem with > > abc.txt file > > The contents of a...

read .txt file in matlab
I had a .txt file stored in my computer containing hex data from TERMINAL software. I want to use his data in MATLAB. Please suggest me some good solution. I am in very much need for solving this problem. thank you. On Jun 12, 9:20=A0am, "Arpan Shah" <arpan1...@gmail.com> wrote: > I had a .txt file stored in my computer containing hex data from TERMINAL= software. > I want to use his data in MATLAB. > Please suggest me some good solution. > I am in very much need for solving this problem. > thank you. ------------------------------------------ You can use dlmread, csvread, fopen/fread/fgetl/sscanf/fclose, importdata, or textscan. ImageAnalyst <imageanalyst@mailinator.com> wrote in message <e65414a7-50de-451f-95aa-3ef31cf0a96b@n11g2000yqf.googlegroups.com>... > On Jun 12, 9:20 am, "Arpan Shah" <arpan1...@gmail.com> wrote: > > I had a .txt file stored in my computer containing hex data from TERMINAL software. > > I want to use his data in MATLAB. > > Please suggest me some good solution. > > I am in very much need for solving this problem. > > thank you. > > ------------------------------------------ > You can use dlmread, csvread, fopen/fread/fgetl/sscanf/fclose, > importdata, or textscan. I had this error using dlmread. ??? Error using ==> textscan Mismatch between file and format string. Trouble reading number from file (row 1, field 1) ==> Termi Also csvr...

txt file reading in matlab
Hi All; I am a newbie to Matlab and i have been trying to read a txt file in matlab. The txt file is in the following form: ***** ANSYS POST26 VARIABLE LISTING ***** TIME 1112 AMPS AMPS REAL IMAGINARY 1000.0 -0.227819E-07 0.154888E-09 2000.0 -0.228048E-07 0.155819E-09 3000.0 -0.228447E-07 0.157469E-09 4000.0 -0.229042E-07 0.160009E-09 5000.0 -0.229876E-07 0.163734E-09 6000.0 -0.231022E-07 0.169153E-09 7000.0 -0.232591E-07 0.177164E-09 8000.0 -0.234780E-07 0.189458E-09 9000.0 -0.237938E-07 0.209521E-09 10000. -0.242766E-07 0.245536E-09 11000. -0.250887E-07 0.320790E-09 12000. -0.267091E-07 0.526497E-09 13000. -0.314035E-07 0.155428E-08 14000. -0.335139E-07 0.701415E-07 15000. -0.115376E-07 0.149262E-08 16000. -0.166103E-07 0.443227E-09 17000. -0.183104E-07 0.258412E-09 18000. -0.191582E-07 0.196778E-09 19000. -0.196659E-07 0.169637E-09 ***** ANSYS POST26 VARIABLE LISTING ***** TIME 1112 AMPS AMPS REAL IMAGINARY 20000. -0.200043E-07 0.155686E-09 21000. -0.202467E-07 0.147811E-09 22000. -0.204297E-07 0.143112E-09 23000. -0.205736E-07 0.140242E-09 ...

Need help in reading mp3 files
Hi All, I am trying to plot the frequency spectrum of a mp3 file with the following code, but i kept encounting the following error: ??? Output argument "out" (and maybe others) not assigned during call to "C:\Users\User\Documents\MATLAB\mp3read.m (mp3read)". Below is my source code. Can anyone advise? Tks [filename, pathname] = uigetfile('*.*', 'Pick any file'); [Y,FS,NBITS,encoding_info,tag_info,out] = mp3read(filename); disp('Playing at the original sample rate.'); sound(y, fs); disp(fs); specgram(y); pause; Y = fft(y); plot(abs(Y)); xlabel('Frequency'); ylabel('Magnitude'); axis([0 length(Y)/2, 0 max(abs(Y))]); pause [nSamples,nChannels]=size(y); waveFileLength=nSamples/fs; N = 2^(nextpow2(length(y(:,1)))); Py=fft(y(:,1),N); NumUniquePts = ceil((N+1)/2); Py = Py(1:NumUniquePts); Py = abs(Py); Py = Py/length(y(:,1)); Py = Py.^2; Py = Py*2; Py(1) = Py(1)/2; if ~rem(N,2) Py(end) = Py(end)/2; end f = (0:NumUniquePts-1)*fs/N; plot(f,Py); title(sprintf('Power Spectrum of mp3 file. Length=%3.1f sec, Fs=%d Sample/sec',waveFileLength, fs)); xlabel('Frequency(Hz)'); ylabel('Power'); ...

need help with reading and saving files
Hello, I try to write script that will read file from disk. The TIFF file. I have 2000 pictures in .tif, named from "photo.000000.tif" to "photo.001999.tif" And I want to make to every file medfilt2 function, medfilt2( , [5 5]); and save every file in the same folder and same name. Any help? On Oct 13, 2:10=A0pm, Krzysztof <kprzychod...@gmail.com> wrote: > Hello, > > I try to write script that will read file from disk. The TIFF file. I > have 2000 pictures in .tif, named from "photo.000000.tif" to > "photo.001999.tif" > And I want to make to every file medfilt2 function, medfilt2( , [5 > 5]); > and save every file in the same folder and same name. > > Any help? ---------------------------------------------------------------------------= -- It's dangerous to overwrite your original files with filtered versions. You'd be better off pcking a new filename, even if you have backups of the originals or even if the new files are in a different folder. That said, you can use dir() to get the filenames, and sprintf() to build up new ones. You may also find fileparts() and fullfile() useful. And you may find section 4.12 of the MATLAB FAQ useful http://matlabwiki.mathworks.com/MATLAB_FAQ Yes I know it is dangerous, but I have back up. I figured out something like that: file =3D'path to file/ photo.00' ; for n =3D 1:2000 if i < 10 p =3D [file, '000' , in...

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 and the related values should be the columns. It's easy for an entry but my text file composed of 544 entries like "alpha-CH chemical shifts". Is there any MatLab code(M-file) to make it easily? Sincerely... ...

Data reading Error. Help needed ASAP
Now I have a very weird problem,I want to import a txt data whose formate l= ikes this:zip_code phone_number date_of_birth109017741|8453684588|10201966 100246445|2125950041|05231952=A0I used the following code to read the data = data a;infile 'C:\Documents and Settings\Desktop\data.txt' DLM=3D'|' dsd mi= ssover truncover;format Zip_Code $30.Client_Home_Phone $40.Client_Date_Of_B= irth mmddyy10.;informat Zip_Code $30.Client_Home_Phone $40.Client_Date_Of_B= irth mmddyy10.;length Client_Home_Phone $40;input zip_code $Client_Home_Pho= ne $Client_Date_Of_Birth mmddyy10.;run;=A0Log shows no error, but he the fi= rst row of SAS data, the Client_Date_Of_Birth is always missing.Just like t= hat =A0109017741 8453684588 .100246445 2125950041 05/23/1952.=A0Could anybo= dy help me? Thanks very much.=A0=A0=A0=0A=0A=0A ...

help need in reading a file using COBOL #2
Hi - I have a input file (Entry sequenced) in below format. D12345678901234567890123456789 D12345678901234567890123456789 D12345678901234567890123456789 D12345678901234567890123456789 D12345678901234567890123456789 D12345678901234567890123456789 D12345678901234567890123456789 D12345678901234567890123456789 D12345678901234567890123456789 D12345678901234567890123456789 D12345678901234567890123456789 D12345678901234567890123456789 T0000012 The input file doesnt have any key(and may contains duplicate). There will be one or more "D" (records starting with "D") records and only one "T" records. "T" records provides the number of"D" records. I need to delete the "T" record first, add few more "D" records and finally write the "T" record with updated count. I dont need to bother about the existing "D" records. it will be untouched. The COBOL program reads each record one by one until it finds the "T" record. Delete the "T" record, Then adds "D" records and "T" record. The issue is, the input file has more than 25 Million "D" records. The programs read the file for "T" for more than 4-5 hours and after which the processing is happening. i would appreciate if one can suggest me a best possible way to reduce the time taken to read. is there a possible way to read the "T" record directly? T...

Re: Data reading Error. Help needed ASAP
Now I have a very weird problem,I want to import a txt data whose formate l= ikes this:zip_code phone_number date_of_birth109017741|8453684588|10201966 100246445|2125950041|05231952=A0I used the following code to read the data = data a;infile 'C:\Documents and Settings\Desktop\data.txt' DLM=3D'|' dsd mi= ssover truncover;format Zip_Code $30.Client_Home_Phone $40.Client_Date_Of_B= irth mmddyy10.;informat Zip_Code $30.Client_Home_Phone $40.Client_Date_Of_B= irth mmddyy10.;length Client_Home_Phone $40;input zip_code $Client_Home_Pho= ne $Client_Date_Of_Birth mmddyy10.;run;=A0Log shows no error, but he the fi= rst row of SAS data, the Client_Date_Of_Birth is always missing.Just like t= hat =A0109017741 8453684588 .100246445 2125950041 05/23/1952.=A0Could anybo= dy help me? Thanks very much.=A0=A0=A0 =0A=0A=0A ...

Real time .txt file read and application of the data
Hi everyone. I am trying to read in some data from .txt file and use those values for calculations in real time. First of all, here is an example of my data: _Vind,_kias | _Vind,_keas | Vtrue,_ktas | Vtrue,_ktgs | _Vind,__mph | -1.35124 | 1.50883 | 1.51432 | 0.00004 | -1.55498 | -1.44434 | 1.56128 | 1.56697 | 0.23752 | -1.66211 | 0.51061 | 0.83771 | 0.84076 | 1.97912 | 0.58760 | 5.52339 | 5.59904 | 5.61944 | 7.32515 | 6.35620 | 13.07874 | 13.15429 | 13.20225 | 15.41028 | 15.05075 | 22.13491 | 22.20988 | 22.29092 | 24.28573 | 25.47240 | 31.48622 | 31.57388 | 31.68928 | 32.95853 | 36.23370 | 38.96954 | 39.03812 | 39.18119 | 41.05450 | 44.84534 | .... and so on There are more columns to the right but there is not enough space here so i just deleted them. Anyways, this file gets updated by a third party program in real-time, when i run that program. I'm trying to make a program that reads this file and put the numbers in an array so i can use them in calculation, which will be running simultaneously with the third party program. Here is what I have now: i=1 while(1) [Vindkias, g1, Vindkeas, g2, Vtruektas, g3, Vtruektgs, g4, Vindmph, g5, Vtruemphas, g6, Vtruemphgs, g7] = ...

report lay-out & reading data from txt-file
allrite folks, got some questions here... 1) LAY-OUT OF REPORTS How is it possible to fundamentaly change the lay-out/form of a report in access? I dont really know it that "difficult", but listen up; Reports, the way I look at them, all present data downwards, in this way; TITLE data data SUBTITLE data data SUB-SUBTITLE data data is it possible to present the data "sideways", like this; TITLE data data data data SUBTITLE data data data data S.S.TITLE data data data data e.g. for making week-schedules and stuff?? 2) READING DATA FROM A TXT FILE Know this better in delphi... What component do I use if I want to load a txt file into my app? How do I open a txt file and display it in the component? How to read the text line by line, reading ONE character at a time, and all the RIGHT$/LEFT$/MID$ functions would also come in handy here... Thanks ! Magnus, Norway "Magnus" wrote > 1) LAY-OUT OF REPORTS > . . . Reports, the way I look at them, > all present data downwards . . . > is it possible to present the data "sideways", like this; > > TITLE data data data data > SUBTITLE data data data data > S.S.TITLE data data data data It depends on the data. If it is suitable, a CrossTab Query in Access 2000 or ...

how to read data from any file to embedded matlab in real time
Hello, Can anyone tell me how can one read data form workspace/.mat/.dat/.txt or just form anywhere, to and embedded function block in simulink.. I have big data to be read in embedded block, which on hardcoding taking very high compilation time.. thanks Arun ...

Real time .txt file read and application of the data #2
Hi everyone. I am trying to read in some data from .txt file and use those values for calculations in real time. First of all, here is an example of my data: _Vind,_kias | _Vind,_keas | Vtrue,_ktas | Vtrue,_ktgs | _Vind,__mph | -1.35124 | 1.50883 | 1.51432 | 0.00004 | -1.55498 | -1.44434 | 1.56128 | 1.56697 | 0.23752 | -1.66211 | 0.51061 | 0.83771 | 0.84076 | 1.97912 | 0.58760 | 5.52339 | 5.59904 | 5.61944 | 7.32515 | 6.35620 | 13.07874 | 13.15429 | 13.20225 | 15.41028 | 15.05075 | 22.13491 | 22.20988 | 22.29092 | 24.28573 | 25.47240 | 31.48622 | 31.57388 | 31.68928 | 32.95853 | 36.23370 | 38.96954 | 39.03812 | 39.18119 | 41.05450 | 44.84534 | .... and so on There are more columns to the right but there is not enough space here so i just deleted them. Anyways, this file gets updated by a third party program in real-time, when i run that program. I'm trying to make a program that reads this file and put the numbers in an array so i can use them in calculation, which will be running simultaneously with the third party program. Here is what I have now: i=1 while(1) [Vindkias, g1, Vindkeas, g2, Vtruektas, g3, Vtruektgs, g4, Vindmph, g5, Vtruemphas, g6, Vtruemphgs, g7] = ...

Help needed Importing a string from labview into matlab for file opening
Hello, I am using labview to allow the user to pick the file to open via the open labview measurement file block. Then I take the filename and convert it from a path to a string and try to import it into my matlab script which I use dlmread() to open my data file. However the datafile does not open. I was wondering if anyone would help me with this method? Thank you, ...

Need help with my code reading flat file into HTML table
I need a little guidance putting a script together. I'm trying to read a list of image links from a text file (not a database) and display them in a table on my page. I want to display them in rows of four. I can get my script to work to display the images but I can't figure out how to do two things: 1. How do I get only one image into each table data entry? 2. How do I get it to create blank table data entries for any amount less than 4 left at the end? (Example: there are 9 images and I want it in the last table row to put the one image remaining and three blank table data entries) Here's what I've got so far: $file = "links.txt"; $result = file_get_contents("links.txt"); $lines = count(file("$file")); $tdcount = 1; $numtd = 4; // number of cells per row echo "<table border=2>"; $arr=array($result); foreach ($arr as $value) { if ($tdcount == 1) echo "<tr>"; echo "$value"; if ($tdcount == $numtd) { echo "</tr>"; $tdcount = 1; } else { $tdcount++; } } // close up the table if ($tdcount!= 1) { while ($tdcount <= $numtd) { echo "<td>&nbsp;</td>"; $tdcount++; } echo "</tr>"; } echo "</table>"; ?> When I echo $result and $lines at the top and exit the script, they both show as they should so the file is being read properly. When I echo $arr, all I get is the word "array". And when I run the...

Re: Data reading Error. Help needed ASAP #2
you already define the informat and format for each variable, I don't see the reason you still need them in your input statement, after remove the informats from the input statement, it seems to read in correctly. input zip_code Client_Home_Phone Client_Date_Of_Birth ; HTH Yu On Tue, Jan 6, 2009 at 1:05 PM, cherub <cherub2life@yahoo.com> wrote: > Now I have a very weird problem,I want to import a txt data whose formate > likes this:zip_code phone_number date_of_birth109017741|8453684588|10201966 > 100246445|2125950041|05231952 I used the following code to read the data > data a;infile 'C:\Documents and Settings\Desktop\data.txt' DLM='|' dsd > missover truncover;format Zip_Code $30.Client_Home_Phone > $40.Client_Date_Of_Birth mmddyy10.;informat Zip_Code $30.Client_Home_Phone > $40.Client_Date_Of_Birth mmddyy10.;length Client_Home_Phone $40;input > zip_code $Client_Home_Phone $Client_Date_Of_Birth mmddyy10.;run; Log shows > no error, but he the first row of SAS data, the Client_Date_Of_Birth is > always missing.Just like that 109017741 8453684588 .100246445 2125950041 > 05/23/1952. Could anybody help me? Thanks very much. > > > > ...

How to read a .txt file (or other file) as a string
Hi, I have to retrieve certain words from a textfile. The textfile contains specifications of a certain model which is used. An example: the 117th line of the file is: 'name hub1 ; hub radius is 0.75m' To get the hub radius, I need to search for a string which is 'hub radius is' and after that save the next token '0.75m' as a string (btw, it is possible that the textfile is altered, so I can not just try to find this string in the 117th line, I need to look through the entire .txt file). But I am already having problems with reading the txt file. How do I read the .txt file as a string in Matlab (readtext reads the textfile as numbers)? And what commands could I use to search for the position of the specified string? Jasper "Jos " <jappedaneels@gmail.com> wrote in message <hd90hv$4q3$1@fred.mathworks.com>... > Hi, > > I have to retrieve certain words from a textfile. The textfile contains specifications of a certain model which is used. > An example: the 117th line of the file is: > 'name hub1 ; hub radius is 0.75m' > To get the hub radius, I need to search for a string which is 'hub radius is' and after that save the next token '0.75m' as a string (btw, it is possible that the textfile is altered, so I can not just try to find this string in the 117th line, I need to look through the entire .txt file). > But I am already having problems with reading the txt file. Ho...

Lauterbach target-host data transfer and file system help needed
I am debugging a data communication target board using Trace32-USB. As the target itself has some problem with its network connection, I want to use the host to send out raw IP packets for testing. Could anyone help: 1) Is there a data channel in Lauterbach ICE that allows explicit exchange of data between the target and the host? 2) If there is one, how do I use it (both within the target code and the host code) If such real-time data transfer is difficult or impossible, another method I can think of is to log the data, save it on the host as a file, then it can be picked up by a host application. Could anyone help for this approach: 1) Is there any document on the Lauterbach file system on host? I know I can save settings and display windows in Trace32. So there must be a file system for Lauterbach. Just don't know how to use it inside a program. If I use the usual open(), write(), close() function calls, what must I do to make sure that it will be saved on the Trace32 file system? The Lauterbach documentation is confusing if anything, so I am hoping someone who has gone through this can give me some pointers Thanks for any help "DGG" <tong.yin@nectech.co.uk> writes: > > The Lauterbach documentation is confusing if anything, so I am hoping > someone who has gone through this can give me some pointers > Lauterbach has a scripting language, PRACTICE, as you probably know. We have used it to automate things like programming FLASH in ou...

continuously read serial data in a txt file & plot it in real time...
hii i have a problem in reading a text file continuously & plotting the value of that txt file continuously in the real time.... i have a string like startxxxxend matlab sends 's' command continuously after some time interval & microconrtroller sends that string continuously... & we have to read only xxxx data & it continuously stores a .txt file..& i have to plot the data continuously i am able to collect the data continuously in txt file ... but i have not able to plot it.. can any body help me out plz... the code is----- clc; clear all; Data_bits=1023; % for 8 bit adc, 2^8 VrefP=5; % supply vcc approx 5V , measure actual by multimeter VrefM=0; % 0V for ground connection of -vref no_ch=2; % No. of channels to acquire data sampling_time=5; % Data acquiring time in seconds %begin_again='N'; read_cmd='s'; str(1)='C'; str(2)=int2str(no_ch); i=0; adc_range=VrefP-VrefM; ser = serial('COM3', 'BaudRate', 9600); %set(ser,'BaudRate',9600,'DataBits',8,'Parity','none','StopBits',1,'FlowControl','none','InputBufferSize', 9600); fopen(ser); % fprintf(s,'%c',str);% sending no. of channel settings error_count=0; tic ; % start a timer while (toc<=sampling_time) fprintf(ser,'%c',read_cmd); uart_rx_data = fscanf(ser); i=i+1 if ( numel(uart_rx_data)==0) % Time out...

Web resources about - Need help reading data from a .txt file - comp.soft-sys.matlab

Reading, Massachusetts - Wikipedia, the free encyclopedia
Coordinates: 42°31′32″N 71°05′45″W  /  42.52556°N 71.09583°W  / 42.52556; -71.09583 Coordinates : 42°31′32″N 71°05′45″W  /  42.52556°N 71.09583°W ...

If you’re not reading this on an Ultra HD monitor, it’s time to upgrade
The days of 1080p providing adequate resolution on a large monitor or television are gone. If you want to be on the cutting edge and get the ...

"For hours, the protesters — about two dozen in total — parked their cars in the middle of the road ...
"... and 'Must Stop Trump," and chanting 'Trump is hate.' Traffic was backed up for miles, with drivers honking in fury. Protesters were also ...

Weekend Reading.: President Obama Unloads on Trump and The GOP
****: [President Obama Unloads On Trump And The GOP](http://crooksandliars.com/2016/03/zero-fcks-president-obama-unloads-trump): >There's a debate ...

Recommended Reading: Olivia Munn on why we're all nerds now
Putting on Her Game Face Connie Guglielmo, CNET Olivia Munn plays Psylocke in the upcoming X-Men: Apocalypse movie and CNET caught up with the ...

Figuring Out The Future By Reading Sci-Fi From The Past
I’ve decided to read a bunch of old science fiction as a way to form some more diverse views of the future. I’ve been reading science fiction ...

Ted Cruz’s Devastating Ice Bucket Challenge Video, A Close Reading
A few years ago, the ALS Ice Bucket Challenge took the nation’s Facebook timelines by storm, as hundreds of thousands of individuals poured freezing ...

Emerging New ‘Lip-reading’ Technology To Radically Revolutionize Modern Day Crime Solving – Report
An emerging new ‘lip-reading’ technology is likely to transform modern day crime solving by flawlessly deciphering visually observed speech captured ...

Stocks Coast To Quiet Finish; Q4 GDP Reading Expected Friday
Monetarists expect faster economic growth to kick in eventually because of recent growth in the broad money supply.

Kickstarter Suspends Funding for Woman Seeking $5K as Fair Pay for Reading Jonathan Franzen
... crowdfunding campaign to receive fair compensation for the complicated, prolonged odyssey into the male mind we otherwise know as “reading ...

Resources last updated: 3/31/2016 6:43:52 AM