f



How can I read X data from one file (.txt), Y data from another file (.txt) and plot a fit of the graph?

I have two files (.txt), one with the X values  and the other (.txt) with the Y values.
Both the files are like this:
 
34
54
76
89
...
 and the number of rows is of course the same in both cases.
 
I want to read them, find a fit for the curve and then have the values of the fit curve disposable for plotting them or for further elaboration.
 
I have tried using "read from spreadsheet.vi" and the "curve fitting" block but I experienced several problems.
 
What can I do?
Thank you very much.
 
Best Regards,
Emanuele Cornagliotti 
 
 
0
x9561 (148440)
2/19/2007 4:10:09 PM
comp.lang.labview 35213 articles. 1 followers. vasusachin24 (1) is leader. Post Follow

3 Replies
1046 Views

Similar Articles

[PageSpeed] 4

You would need two separate Read From Spreadsheet functions but if you are using the Curve Fitting Express VI, then you need to convert the x and y data to a dynamic data type. You do this and wire to the Signals and Locations inputs. Instead, you can use the lower level curve fittings functions (i.e. Linear Fit) which accept separate x and y arrays as inputs.
<img src="http://forums.ni.com/attachments/ni/170/230818/1/Curve%20Fit%20from%20Two%20Files.PNG"> Message Edited by Dennis Knutson on 02-19-2007  09:37 AM


Curve Fit from Two Files.PNG:
http://forums.ni.com/attachments/ni/170/230818/1/Curve Fit from Two Files.PNG
0
x9561 (148440)
2/19/2007 4:40:12 PM
This is actually what I did. I used the curve fitting module (using a spline interpolant)&nbsp;and i converted the data to the dynamic data type:
The problem that I experienced are the following:
1) If I plot the output&nbsp;I always get a graph with time on the X-axis (see picture attachment). In practice the shape of the graph&nbsp;seems&nbsp;correct but the values of the X-axis have nothing to do with the real values&nbsp;I have in the file (Injection levels_Si.txt) and moreover they are labelled as "time". The other file I have attached (Mobility_Sum_Si.txt) is the Y axis.
2) Even if I set in the "read from spreadsheet.vi" the path of those two files I always have to re-input them every time I run my .vi. Instead, I would like to make the program read always from those two files without asking during its execution.
&nbsp;
How can I do?
&nbsp;
Thank you!!!!!!!
&nbsp;
Emanuele Cornagliotti
&nbsp;
&nbsp;


Mobility_Sum_Si.txt:
http://forums.ni.com/attachments/ni/170/230948/1/Mobility_Sum_Si.txt


Output.jpg:
http://forums.ni.com/attachments/ni/170/230948/2/Output.jpg


Injection levels_Si.txt:
http://forums.ni.com/attachments/ni/170/230948/3/Injection levels_Si.txt
0
x9561 (148440)
2/20/2007 9:40:11 AM
The 'time' and 'Amplitude' on a graph are just labels. Double click on the text to change it. You can also go to the graph's properties and the Scales tab to change the Name.
I apologize - I only showed part of the process. If you use the low level functions (top part in my example) this only returns an x array. To plot the new curve with the original x, just bundle them together and wire to an XY graph. You can also overlay the original XY plot. I haven't used the express function but you can take the output of the express curve fitting and wire that to the Y input of the express XY graph and the x input would be the same that you wired to the locations input.
If you don't want to keep being prompted for file names, just create a constant. On the diagram and on the path input, right click and select 'Create&gt;Constant'. You could also have a front panel control with the paths defined. Right click on a control and select Data Operations&gt;Make Current Value Default. After you do this, you have to save the VI.
0
x9561 (148440)
2/20/2007 3:10:09 PM
Reply:

Similar Artilces:

Separate data from text in a txt file? or fetch the data in txt file
hello, I have a txt file as in the below. And what i am trying to do is to be able to fetch my data and plot them. i have been using 'fscanf' but i wasn't able succeed. i was wondering if anyone knows an easy way to separate data from a txt or dat file, so that i can use just the 'load' function to process my data? Field Output reported at nodes for part: PART-1-1 Computation algorithm: EXTRAPOLATE_COMPUTE_AVERAGE Averaged at nodes Averaging regions: ODB_REGIONS Node U.U2 S max S.S11 Label @Loc 1 @Loc 1 @Loc 1 ----------------------------------------------------------------- 1 -508.707E-03 3.55079E-03 -1.19326 2 -460.343E-03 197.177E-03 -1.09810 3 -460.343E-03 197.177E-03 -1.09810 4 -508.707E-03 3.55079E-03 -1.19326 5 -458.758E-03 818.933E-03 793.610E-03 6 -458.758E-03 818.933E-03 793.610E-03 7 -504.776E-03 862.675E-03 842.660E-03 8 -504.776E-03 862.674E-03 842.660E-03 9 111.270E-03 48.0522E-03 48.0480E-03 10 -318.989E-03 4.07685E-03 2.47891E-03 11 135.668E-03 4.23023E-03 -1.19628E-03 12 -319.035E-03 612.056E-06 -1.81646...

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

[Fwd: Re: How can i get data from .txt file and .xml file?]
-------- Forwarded Message -------- From: Reid Thompson <Reid.Thompson@ateb.com> Reply-To: Reid.Thompson@ateb.com Subject: Re: How can i get data from .txt file and .xml file? Date: Wed, 20 Jun 2007 09:31:30 -0400 On Wed, 2007-06-20 at 22:20 +0900, Karl von Laudermann wrote: > On Jun 20, 3:38 am, Alex Gutteridge <a...@kuicr.kyoto-u.ac.jp> wrote: > > On 20 Jun 2007, at 16:15, Cool Wong wrote: > > > > > I have .txt file that is .xml format. i using require "rexml/document" > > > and include REXML, but i don know how to get data from the .xm...

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

read labview data file (txt or bin ) in matlab
Dear all, &nbsp; How can I read data collected from NI Multifunction DAQ cards&nbsp;using labview to use it in matlab? ...

Data analysis of data from txt file
Hi I have a txt file with the following columns with n rows: 18-03-2014 12:54:19 19.9 48.1 23.4 1002.3 18-03-2014 12:54:24 19.8 48.1 23.4 1002.3 18-03-2014 12:54:29 19.8 48.1 23.4 1002.3 18-03-2014 12:54:34 19.8 48.1 23.4 1002.3 18-03-2014 12:54:39 19.8 48.3 23.3 1002.3 18-03-2014 12:54:44 19.8 48.3 23.3 1002.3 18-03-2014 12:54:49 19.8 48.3 23.3 1002.3 I want to write the date-time string and column 2 to a new txt file that should look like: 18-03-2014 12:54:19 19.9 18-03-2014 12:54:24 19.8 18-03-2014 12:54:29 19.8 18-03-2014 12:54:34 19.8 ...

read in ascii file which plots two data in one graph
Hi, &nbsp; I want to plot two graphs into one graph. The VI should read in the ascii text file and then plot the&nbsp;data. I know how to plot&nbsp;only one graph but, I want to know how to plot multiple graphs into one xy axes graph. The data file is a&nbsp;3 X 21 Array. The first row is the x values going from negative one to&nbsp;one with a 0.1 increment. The second row squares all the x values from the first row. So, if&nbsp;x is -0.9 then its square is 0.81. The&nbsp;third row does the same thing but, this time it takes the cube of the x values. So, if x is&nbsp;-0.9 then the cube of this value becomes -0.729. I have created a VI that would plot these values. When I run the VI, it only takes the first&nbsp;two rows and deletes the third row which is the cube of the x values. I will attach my VI, the&nbsp;text file, and the graph of how it suppose to look like. I have plotted the graph on matlab but, I want to use labview to do the samething. I also created a table&nbsp;so I can see what numbers are being fed in the read from&nbsp;spreadsheet file. The numbers are coming out correctly but, the last row is deleted from the array.&nbsp;Can someone help me here because I was working&nbsp;on this for a quite some time. Thanks. &nbsp; Fidaali&nbsp;&nbsp; Untitled.jpg: http://forums.ni.com/attachments/ni/170/332606/1/Untitled.jpg test3.txt: http://forums.ni.com/attachments/ni/170/332606/2/test3.txt text t...

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

reading data from a .txt file
I am using LabView to open a .txt file created by another program&nbsp; (fibox) every second and copy data out.&nbsp; Meanwhile, the fibox program writes data to the .txt file every second.&nbsp; The problem is that eventually the fibox program crashes (this only happens when I run it simultaneous with this particular LabView program).&nbsp; Is there some way to fix this by altering my LabView program (without messing with the fibox program)?&nbsp; Thanks!!! ...

Reading Data from a txt file
I need to read data from a .txt file (I can choose the delimiter, currently using /t) into a cell array. But I can't figure out how to do it in a flexible manner, because the files have different numbers of rows and columns, as well as a mix of both strings and numbers. I want to be able to input a text file and get out an array with all of the data, no matter how many columns or rows the input file has. On 10/11/2012 1:31 PM, Thomas Arnold wrote: > I need to read data from a .txt file (... Responded to your other thread--don't post multiple times on the same topic... -- ...

Read data from .txt file
Hi. I'm working on a project based on matrix and I've used for my codes an MFile in which i ask the date that must be insert into the matrix. I want to know if is possible to put the information of the matrix (number or rows, number of columns, value of the a11, a12...a1n, and so on, of the matrix, etc etc) in a txt file and read this information using matlab. I mean there is a way with which the MFile can read the informations that i've put in the txt? tnx to all for answers martinmistere: <SNIP wants to create a ML-<ini> file... one of the many solutions %1) put all i...

continuously read serial data in a txt file & plot it in real time... #2
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...

How can I plot x,y,z, data from excel file (geographic info) on map using mapping tool box from matlab?
Hi everyone, i really don't know much about matlab, but I have been asked to work on this project using matlab. What I have to do is basically plot data x,y= long lat and z= variable on world map. Im using the mapping tool for this project and wanted to link this data on to one of the maps from the mapping tool. I am really unkilled wioth theis program, so patience and a good explanation is greatly appreciated. ...

x- and y-data from different data blocks in file
hi everybody, i would like to plot an xy-graph from an input data file which is composed of different data blocks like: header col1 col2 col3 ... <empty line> <empty line> header col1 col2 col3 ... <empty line> <empty line> header col1 col2 col3 ... <empty line> <empty line> etc... while col1, col2, ... denote columns of data with a certain number of rows. now i would like gnuplot to e.g. use the 2nd column of the first data block as x-coordinates and column 3 of the third data block as y-values. any ideas? best regards, jan reprocess your data into a form more suitable for plotting. there may be a trick to get this to work in gnuplot (i doubt it), but it will be much easier for you to use your favorite language (i'd use perl) to reformat the data for you. ...

Reading numeric data from a .txt file
Hi, I'm processing data and I'm barely new with MatLab. I got a problem reading numeric data from a file that is in text format, wich are represent as follows: TIM 070116023400 TIM 070115223548 01/15/07 21:45:39 1223 189 TIM 070116023500 TIM 070115223648 01/15/07 21:46:39 1223 181 TIM 070116023600 TIM 070115223748 01/15/07 21:47:39 1223 187 Each column is separated with tabs, and my goal is discard all the text character as 'TIM' or similar and have only columns of numeric data, such like this: 070116023400 070115223548 01/15/07 21:45:39 1223 189 070116023500 07...

algorithm to read data from .txt file
I must read data from a .txt file.The file looks like that Server1 ID Name Status UseCase ID Name Flow Message ID From To Message ID . . . EndFlow EndUseCase EndServer Server2 ID Name .. .. .. the structur of the data is : there are some Servers,each has own informations(ID,Name,Status) and contains some different UseCase,each of them has own informations,too.And the UseCase is like Server,it contains some Flow.The Flow contains some Messages.The Messages has 3 values(ID,From,To). the number of Servers,UseCases,.. is in every files is nicht the same The structur is of the file is...

read and modify data of a txt file
hello everybody, I work on a project and I have to modify a big txt-file in order to make simulations. I wanted to know if you can help me. I did not manage to read the file and to organise the data in order to read them and modify some of them (typically : change one parameter every 10 lines for example but the number of column may change...). If someone is intersted, I can send him the txt file, to have a quick view. Thank you for your understanding PS : I'm french, responses can be in french or english. Can you be a bit more specific about the type of data contained in your .txt file and also how did you try to read it? Aurelien wrote: > > > hello everybody, > > I work on a project and I have to modify a big txt-file in order > to > make simulations. I wanted to know if you can help me. I did not > manage to read the file and to organise the data in order to read > them and modify some of them (typically : change one parameter > every > 10 lines for example but the number of column may change...). > If someone is intersted, I can send him the txt file, to have a > quick > view. > > Thank you for your understanding > > PS : I'm french, responses can be in french or english. Thank you Fivos for your attention. The txt-file contains 12 973 lines and more than hundred columns. The data are figures and words (word correspond to the name of satellite and the figures are the associated characteristics). The Prob...

Reading in data from a *.mat file one data point at a time
I am currently undertaking final year thesis project in order to graduate as an Electrical Engineer. The project aims to build an engine to classify activities, in real-time, from a streaming input of motion sensor data. I am only working on the engine and not the practicalities of a streaming input. The aim is 'real time classification' which means that RAM space is at a premium. I am aiming to simulate streaming data by reading from a file one data point at a time. I assumed the *.mat format was best to save the data in as this was native to Matlab, if this is not the case can...

To update one file with the another file's data..
Hi, I have two text files: each one has has four fields (delimited by a space) on each line: id, group, email and manager_id. First file is a small file with 50 entries and the second one is a huge file with 5,000 entries. The "id" field is same in both files, but the manager_id's may be different. By comparing all the entries in the second file (that has the correct manager id), I need to update the manager_id field in the first file. Here is the code, I am thinking of: ----------------------------------------- open (INPUT1,"smallFile.txt") or die "Cannot open...

Hyperlink to network => \\server01\data\file\file.txt
Hi, I would like to create an hyperlink to a network file (\\server01\data\file\file.txt), is it possible ? ArthurAccroc schrieb: > Hi, > I would like to create an hyperlink to a network file > (\\server01\data\file\file.txt), is it possible ? > Where? In a mail it depends: - the client has to recognize the file:// protocol - the in the location document registered browser must support this (IE does, Firefox doesn't) - The user has to enable "Make Internet URLs into Hotspots" Just send a mailt to yourself with file://server/data/file/file.txt as b...

Plotting data from a data file
Hi. I wanted to know how to plot a curve from a data file . Data file is generated by using PSIM. It contains all points of time, current , voltage. Thanking you. Sachin "SACHIN DEVASSY" <sachindevassy@gmail.com> wrote in message <h2i2rt$62c$1@fred.mathworks.com>... > Hi. > > I wanted to know how to plot a curve from a data file . Data file is generated by using PSIM. It contains all points of time, current , voltage. Thanking you. > > Sachin what is a psim file: ASCII/binary/... us > what is a psim file: ASCII/binary/... Psim is used for s...

extracting .tar files and reading .txt data
I have the following problem: I want to download a tar file and extract the data into matlab. But I cannot extract the data! I have the following code but doesnt do the work. url = 'http://prep2009.ife.org.mx/PREP2009/20090706_2000-listaActas.tar.gz'; file = untar(url); fid=fopen('diputados.txt'); C_text=textscan(fid,'%s',25,'delimiter','|'); C_data=textscan(fid,'%d %d %d %s %d %d %d %d %d %d %d %d %d %d %s %d %d %d %d %d %s %d %s %s %s','delimiter','|'); The text file has originally 6 header lines but I deleted them be...

how to read data from a .txt file in real time
Hi &nbsp; I am running a fortran code which takes around 1 week to run and output data are continuously saved in .txt files. I want to display these data and plot it against time in labview. &nbsp; Lets say I have a array of real numbers starting from 1.0 , and every 2-3 sec another number is added (output of code). So I dont want end-of-file-reached error in my program and also want program to wait until next data is updated in .txt file. &nbsp; I tried to make a simple read_txt_file.vi, but I am getting problems in terms of continous reading. Help !! Help !! &nbsp; Pl see t...

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

Web resources about - How can I read X data from one file (.txt), Y data from another file (.txt) and plot a fit of the graph? - comp.lang.labview

"Brothers for Bernie"? "Sisters for Sanders"?
Why has Democratic presidential candidate Bernie Sanders failed to seal the deal with most African-American voters? The rejection of Sanders ...

Paris attacks suspect charged in Belgium, fights extradition
Reuters Paris attacks suspect charged in Belgium, fights extradition Reuters BRUSSELS Salah Abdeslam, the prime surviving suspect in November's ...

Heavy winds as Dubai plane crashes in Russia, killing 62
MOSCOW (AP) — A Dubai airliner with 62 people on board nosedived and exploded in a giant fireball early Saturday while trying to land in strong ...

Will Hulk Hogan Go Out Like Food Lion?
Amidst the many jaws dropping on Twitter Friday night in reaction to a Florida jury quickly awarding $115 million in damages to Hulk Hogan against ...

Countdown to doomsday: Apple, FBI face off in court Tuesday
In their struggle over cracking into an iPhone used by a terrorist, both sides present scary scenarios for what will happen should the other ...

Insomniac Games CEO on the challenges of making games for VR
As the Founder and CEO of Insomniac Games, Ted Price is responsible for esteemed console games like Ratchet and Clank, Sunset Overdrive and Fuse. ...

EU Migrant Proposal: Thousands Of Migrants To Be Sent Back To Turkey, Will Turkey Agree?
EU leaders met in Brussels in order to come up with a solution to handle the migrant crisis caused by the civil war in Syria. The proposal that ...

Microsoft apologizes for GDC party with scantily clad dancers
(By Anya George Tharakan, Reuters) – Microsoft apologized for hiring dancers dressed as skimpily-clad schoolgirls for its Game Developer Conference ...

Twitter Sticking To 140 Character Limit – Why Did CEO Jack Dorsey Yield To Users’ Demands?
Twitter will stick to 140 character limit. Jack Dorsey, the micro-blogging platform’s co-founder and chief executive assuaged its user base by ...

Brisbane Election 2016: Results - The Courier-Mail Search Search
LORD Mayor Graham Quirk has kept Brisbane’s top job and The Greens are set to win a seat as election night comes to a close.

Resources last updated: 3/19/2016 4:32:16 PM