Saving data from 1d array of cluster of 2 elements: HP 8752 driver
I'm using the following driver to communicate with my HP 8720C Network Analyzer
http://sine.ni.com/apps/utf8/niid_web_display.download_page?p_id_guid=E3B19B3E9092659CE034080020E748...
...So far I've easily been able to use the "collect and display data" vi, except for saving data. All I want to be able to do is save the data from a single sweep in spreadsheet format. Displaying the data is no problem, which I can then print, however, the output data file is a mess. The VI is rather complicated, and I can't figure out how to save the data in a nice pair of columns of numerical values.
The VI's output data is in the format of a 1 dimensional array of clusters of 2 elements (ie the x-y values). I would've thought it would be trivial to do this, since this is the standard format for data for the classic X-Y graph. So far, I haven't been able to come up with anything. Any ideas?
Thanks,
Spence
Feed the array of clusters into a for loop with autoindexing enabled (the default). Inside the loop use the Unbundle primitive to extract X and Y for one point. Use Build Array to make a two-element array from X and Y. Wire this array out of the for loop and you will have a two dimensional array with two columns and as many rows as there are elements in the array of points.
Lynn
Similar Messages
-
Hello,
in my vi I have a chart with 5 Plots displaying measurement data.
The user should be able to save all the history data from the chart at anytime. (e.g. the user watches the chart and some event happens, then he presses a "save"-button)
I know, that I can read out the history data with a property node. That is not the problem. The problem is, how do I handle the data? The type of the history data is a 1-D array of cluster of 5 elements.
I have to convert that data somehow into a 2 D-array of numbers or strings, so that I can easily save it in a text-file.
How do I convert a 1-D array of cluster of 5 elements into a 2-D array of numbers?
I use LabVIEW 7.1
Johannes
Greetings Johannes
Using LabVIEW 7.1 and 2009 recently
Solved!
Go to Solution.Gerd,
thank you for the quick response and the easy solution.
Look what I did in the meantime. I solved the problem too, but muuuch more complicate :-)
And I have converted the numbers to strings, so that I can easily write them into a spreasheet file.
Johannes
Message Edited by johanneshoer on 04-28-2009 10:39 AM
Greetings Johannes
Using LabVIEW 7.1 and 2009 recently
Attachments:
SaveChartHistory.JPG 57 KB
SaveChartHistory.JPG 57 KB -
Without loops how can i read data from associative Array??
Hi all,
I am facing scenario like...
i need to read data from associative array without using loops is it possible,
CREATE OR REPLACE PACKAGE BODY test_pkg IS
TYPE t1 IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
-- in array we can expect more than one row or sometimes no data also.
FUNCTION test1(vt1 T1 DEFAULT CAST(NULL AS t1)) RETURN NUMBER IS
BEGIN
-- basically in array we'll get data of column2
-- this loop should satisfies table1.colum2 = nvl(NULL, table2.colum2 )if array is null.
-- if array is not null then only compare with array values
FOR i IN (SELECT t1.colum1,t1.column2
FROM table1 t1, table1 t2
WHERE t1.colum1 = t2.column1
AND t1.colum2 = nvl(vt1, t2.colum2)
LOOP
generateTEXT(i.colum1, i.colum2);
END LOOP;
END test1;
END test_pkg;
in table1 we have date like...
colum1 column2
Jan 1
Feb 2
Mar 3
if i call select test_pkg.test1(1) from dual then output should
be Jan..
and
select test_pkg.test1(null) from dual then it should display all elements from table1.
Jan 1
Feb 2
Mar 3,
Thanks for your quick replay..i need to read data from associative array without using loops is it possible,
No - you would need to create a SQL type and then use the TABLE operator to unnest the collection.
create or replace TYPE my_nums IS TABLE OF INTEGER;
DECLARE
-- TYPE my_nums IS TABLE OF PLS_INTEGER INDEX BY PLS_INTEGER;
v_nums my_nums := my_nums(1, 2, 3);
v_total number;
BEGIN
select sum(column_value) into v_total from table(v_nums);
DBMS_OUTPUT.PUT_LINE
('Sum of the numbers is ' || TO_CHAR(v_total));
END;
Sum of the numbers is 6 -
hi all.
I have an issue regarding saving data from alv to data base table.
The problem is like this. I have an internal table consist of 10 column from three diferent tables.one primary key is there.
now i have displayed it in alv grid. there is a column of quantity. i made some changes in quantity of some rows. now i want to save it into the database table from which that quantity field fetched.
i used first check_changed_data method. if the flag is set it means data is changed.
wat shud i do to save that quantity column into data base.
Thanks In advance.
varuHi,
<b>To modify database or ztable from the ALV grid,you need to do the following:</b>
---You have to modify the field Catalog fields (fields that you want to make editable).Set the field <b>EDIT as 'X'</b>.For example if you want to make the field below editable:
ls_fcat-fieldname = 'CARRID'.
ls_fcat-edit = 'X'.
APPEND ls_fcat TO pt_fieldcat.
---Call the method below before you call the set_table_for_first_display.
CALL METHOD ALV_GRID_INSTANCE-><b>set_ready_for_input</b>
EXPORTING
i_ready_for_input = 0. ( For Display ) and ('1' for Edit )
After this put the set_table_for_first_display.
<b>Now if the ALV data has changed,and you want to change the database or ztable,then in your pf status give a function code for SAVE button in the GUI.
In the PAI of the screen,in user command module write the following:</b>
WHEN 'SAVE'.
<b>call method gr_alvgrid->check_changed_data</b>
importing e_valid = l_valid.
if l_valid = 'X'.
<b>MODIFY spfli FROM TABLE itab_spfli.</b>
endif.
<b>(l_valid is a flag.</b>
DATA:l_valid type c.
If you want to check if the user has entered any value on the grid, use the Method : CALL METHOD gr_alvgrid->check_changed_data.
This method returns a flag l_valid which can be checked to see if the data on the ALV grid has been changed or not.)
Regards,
Beejal
**Reward if this helps -
Error while retrieving data from an ARRAY resultset
We hava an Oracle stroed procedure which has a table type as its OUT parameter and where the data is being entered into. This data requries to be returned to the Java client through a JDBC connection. We have used the OracleTypes' ARRAY object for this. We are facing errors when retieving data from the ARRAY resultset
The Oracle Package
----I created a table type called "PlSqlTable":
CREATE OR REPLACE TYPE PlSqlTable IS TABLE OF VARCHAR2(20);
----I defined this as the out parameter for my procedure :
PROCEDURE testSQL
arrayOutID OUT PlSqlTable
Then populated the object :
arrayOutID := PlSqlTable();
arrayOutID.extend(4);
arrayOutID(1):= 'Hello';
arrayOutID(2) := 'Test';
arrayOutID(3) := 'Ora';
----The procedure executes fine - all debug statements are printed ----right till the end of execution.
The Java class
----Here is how I have defined the parameters :
OracleCallableStatement stmnt = (OracleCallableStatement)connection.prepareCall("begin testSQL(?);end;");
stmnt.registerOutParameter(2,OracleTypes.ARRAY,"PLSQLTABLE");
System.out.println("Executing..");
stmnt.execute();
System.out.println("Executed..");
ARRAY outArray = stmnt.getARRAY(1);
System.out.println("Got array");
ResultSet rset = outArray.getResultSet();
System.out.println("Got Resultset..");
int i = 1;
while(rset.next()){
System.out.println("VALUE : " + rset.getString(i));
i = i+1;
----On execution, the debug messages display :
Executing..
Executed..
Got array
Got Resultset..
VALUE : 1
VALUE : Test
ERROR : java.sql.SQLException: Invalid column index
----But I have populated upto 3 values in th e procedure. Then why this error ?
PLLLEEEASE help me out on this.
Thanks, Sathyahaven't worked with db arrays but I think your problem is here:int i = 1;
while(rset.next()){
System.out.println("VALUE : " + rset.getString(i));
i = i+1;
}In the first loop you are retrieving the value from column 1(rs.getString(1)), which is OK, but in the second loop, you are trying to retrieve a value from the second column(rs.getString(2)) which doesn't exist. Try this code which only reads from column1:
while(rset.next()){
System.out.println("VALUE : " + rset.getString(1));
}Jamie -
I lost my iphone. How can I get my saved data from back up on my new laptop?
Dear Friends,
I did a mistake as when selling my iphone I did not get my saved data from my iphone back up. Now I have a new laptop and I want to get my backed up data.
Is there any way I could get or as Apples traditional greed ... more money more money ...more .. more??????
Please help if I can get back my at least contacts and video for free. I do not are for my music. My God it is so difficult to get going with Apple.stedman1 wrote:
A warranty does not cover physical damage. Did you have AppleCare +?
AppleCare+ doesn't cover loss or theft, only accidental damage. -
How to delete a particular data from 3 arrays
hello,
i have a program that works like this.....
import java.io.*;
public class NewMain {
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
String [] Type= new String[10000];
int [] Num= new int[10000];
float [] Price= new float[10000];///////
and i am reading some of the data into these arrays
so if i want to delete a particular data from the arrays how do i do that
and if i want to delete pants from that file and enter the text again how do i do that.? any idea?....
e.g if the file contains
shirt
32
56.5
pants
56
45.9Ashish.Uppin wrote:
hello,
i have a program that works like this.....
import java.io.*;
public class NewMain {
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
String [] Type= new String[10000];
int [] Num= new int[10000];
float [] Price= new float[10000];///////
and i am reading some of the data into these arrays
so if i want to delete a particular data from the arrays how do i do that
and if i want to delete pants from that file and enter the text again how do i do that.? any idea?....
e.g if the file contains
shirt
32
56.5
pants
56
45.9
Buddy, it seems to me that you are describing data that belongs together -- a class. You are probably better off with one arraylist of objects of this class, each object having a String type variable, an int num variable, and a float price variable, make that a double price variable.
For examples of arraylists in action, please see the Sun java tutorials. -
What is the best way to move data from one array to another
I'm going to be moving data from one array to a larger array on the same RAID but different controller. (I have some extra extra drives I'm also going to be installing Retrospect so I can't just restore from a backup.)
The RAID has 450GB of production files, fonts etc.
What is the best way to move the data over?
I saw that someone had suggested using ditto. Would that be better than MacMV?
I also own Bru LE so I could use that.
Any advice would be appreciated.
Thanks,
PaulDitto is a great option -- probably the best.
ditto -rsrc src_folder /Volumes/targetvolume/targetfolder -
Connect 1 D array of cluster of 2 elements with dynamic data
Hello
The type of source is 1D array of cluster of 2 elements and the type of sink is dyanamic data. Can any one guide me how to connect these 2 elements together. Any response would be highly appreciated.
ThanksFirst, this question would more appropriately be posted to the LabVIEW Board. It is not a signal conditioning issue.
The dynamic data type (DDT), sometimes referred to as the "evil dynamic data type," completely obscures the internal data structure. The only way someone could help is if you tell us what the source is expecting the internal data structure to be. The only objects which want DDT inputs are Express VIs, which are also good at obscuring thier contents. Implementing the sampe funcitonality with standard VIs might be a better approach.
You also have not completely specified the source. What are the data types of the cluster elements?
Lynn -
1D Array of Cluster of 2 Elements Write to Spreadshee​t
Hi all, first time using LabView in many years. I am trying to write a VI that will acquire data from our cDAQ (right now just trying to get it to work with a single thermocouple in a NI 9211, but eventually will be 8 X thermocouple, 4 X pressure transducer), display it in realtime on a plot, and then when the acquisition is stopped, output the data to a file for later use. I am currently using the Base LabView package.
My problem (as I remember it was 7 years ago when I last used this) is with the data types not working together. This is my thought process currently on building this VI. Everything is inside a While Loop with the Wait function at 1000ms.
- Acquire a point of data using the DAQ assistant
- Send that point of data into a bundle
- Send the iteration count into the same bundle (as a timestamp)
- Send the resulting cluster of 2 elements into a Build Array function
- Send the resulting 1D array to a shift register in the While Loop, as well as to an XY graph for realtime plotting
- Wire the incoming point on the shift register back into the Build Array function
In my mind, this allows the XY graph to plot the complete array every iteration, giving a realtime view of the signal. Everything works fine up to this point. My problems are:
When I stop and restart the program, the shift register is not cleared, so the existing data in the array remains on the graph. I know I need to initialize the shift register to clear it, but I cannot figure out what to wire to it that will be compatible with the data type (I just get broken wires with everything I tried).
Similarly, I cannot figure out how to output this data to a spreadsheet after I Stop the While Loop. I think I should wire the "Write to Spreadsheet File" VI to the outgoing shift register, but again, I can't get compatibility with data types (source is a 1D array of cluster of 2 elements).
I have attached my current program "Production" to this post.
I look forward to the help!
Brad
Attachments:
Production.vi 46 KBHi Brad,
I would suggest you change your architecture. First, to answer your questions:
1.
In order to ensure that your shift register is not reading the last
value from it's memory location, you just need to create a constant for
the shift register. To do this, right-click at the input of the
'left-placed' shift register and create a constant.
2. The Write
to Spreadsheet is expecting a 1-d or 2-d array while you are wiring a
Dynamic Data Type. Use the Convert from Dynamic Data Type to convert
the data into the appropriate waveform after which you can get the
waveform attributes which includes the values and the timestamp data. Or, you can use the Write to Measurement File to write to a .lvm file which can be opened in Excel as well.
Changes to your architecture:
Since
you are using a lot of channels, I would advise you use a
producer/consumer architecture. You can have a look at this
architecture by navigating to File -> New.. and searching for the
Producer/Consumer template. You will notice that this architecture uses
queues. The way you will design your VI is to use DAQ to acquire the
data into your producer loop, convert this data into a waveform and
then send this data to the consumer loop via queues. In your consumer
loop, you can write this data to a file. At this point, I would
encourage you to write to a binary file instead of a spreadsheet file. The write will happen faster and you will be using less space on your hard disk when compared to ASCII writes.
I know this can be real confusing for a beginner, so be sure to post back if you have any questions.
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies -
Write an 1d-array of cluster with 3 elements
Hi,
I have to make a "Power spectral densities" analyse from my waveform data. The results from this VI is an array of cluuster with 3 elemments. Now I want to write this array of cluster with 3 elements to a file. And later it must be able to use this file with EXCEL!!
thanksHi
I found some outer Forum entries about this topic.
Look at this links:
http://forums.ni.com/ni/board/message?board.id=170&message.id=49553&requireLogin=False
http://forums.ni.com/ni/board/message?board.id=170&message.id=51526&requireLogin=False
I hope this helps
Manuel -
How can I write a 1d array of cluster with 3 elements to a file?
Hi,
I have to make a "Power spectral densities" analyse from my waveform data. The results from this VI is an array of cluuster with 3 elemments. Now I want to write this array of cluster with 3 elements to a file. And later it must be able to use this file with EXCEL!!
thanksHello schloronzo,
make a for loop feeded with your array. Inside the for loop unbundle
the cluster, "format into string" the 3 values, adding the result to
the ones before and collect them in a shift register. Then save the
resulting string to a txt-file. If you make a good format string then
Excel is able to read your txt-file (use tab a separator and CR/LF
after each 3 values aka "csv format").
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
Write 1d array of cluster with 2 elements to file
HI!
I'm new at LabView so I hope the question is very simple to you:
I am using a waveform graph to display several measurements.
Now I want to save these Measuremens. The data are stored in 1d array of cluster with 2 elements.
What is the easiest way to do this??
ThanksIf you are already using waveforms you can simply wire right up to "Write Waveforms to File.vi" in the Waveform palette under Waveform File I/O.
Daniel L. Press
PrimeTest Corp.
www.primetest.com -
How to insert 300 data from associative array to backend table in PL/SQL
HI ALL,
I'm posting my code here:
Creating back end table:
Create table orlando
( id number(20),
calltype number(12),
gateway_name varchar2(25),
accounting_id varchar2(18),
start_time_system_ticks number(11),
node_time_zone varchar2(25),
start_date varchar2(10),
start_time varchar2(10),
softswitch_response number(11),
alerting number(11)
Creating package:
CREATE OR REPLACE PACKAGE r IS
type apollo_rec is record(
id number(20),
calltype number(12),
gateway_name varchar2(25),
accounting_id varchar2(18),
start_time_system_ticks number(11),
node_time_zone varchar2(25),
start_date varchar2(10),
start_time varchar2(10),
softswitch_response number(11),
alerting number(11)
TYPE bin_array IS TABLE OF apollo_rec INDEX BY BINARY_INTEGER;
PROCEDURE rr (state_array bin_array);
END ;
SET SERVEROUT ON
CREATE OR REPLACE PACKAGE BODY r IS
PROCEDURE rr (state_array bin_array) IS
BEGIN
FOR i IN 1 .. state_array.COUNT LOOP
INSERT INTO orlando(id,calltype,gateway_name,accounting_id,start_time_system_ticks)VALUES(state_array(i).id,state_array(i).calltype,state_array(i).gateway_name,
state_array(i).accounting_id,state_array(i).start_time_system_ticks);
COMMIT;
END LOOP;
END ;
END ;
I've run this code in i*SQL PLUS.But when I run this code for 5 entries there is no error but when I modify the insert statement for 300 entries(300 identifiers in the insert statement)
it gives me error:
Warning: Package Body created with compilation errors.
Errors for PACKAGE BODY R:
LINE/COL ERROR
7/2 PL/SQL: SQL Statement ignored
7/14 PL/SQL: ORA-00913: too many values
Is there any feature in PL/SQL to decrease the entries in insert statement and make the insert statement along with the program small and increase the program performance.
Edited by: 983040 on Jan 20, 2013 11:11 PMBasic example (ran on 11.2.0.3):
SQL> create table testtab( id number, day date, val varchar2(30) );
Table created.
SQL>
SQL> create or replace package TestTabLib as
2
3 type TTestTab is table of testtab%rowtype;
4
5 procedure InsertRows( rowArray TTestTab );
6
7 end;
8 /
Package created.
SQL>
SQL> create or replace package body TestTabLib as
2
3 procedure InsertRows( rowArray TTestTab ) is
4 begin
5 forall i in 1..rowArray.Count
6 insert into testtab values rowArray(i);
7 end;
8
9 end;
10 /
Package body created.
SQL>
SQL> declare
2 rowArray TestTabLib.TTestTab;
3 begin
4 --// populating the array - using a bulk fetch as
5 --// an example
6 select
7 object_id, created, object_name
8 bulk collect into
9 rowArray
10 from all_objects
11 where rownum < 11;
12
13 --// bulk insert array
14 TestTabLib.InsertRows( rowArray );
15 end;
16 /
PL/SQL procedure successfully completed.
SQL>
SQL> select * from testtab;
ID DAY VAL
100 2011/12/05 09:16:03 ORA$BASE
116 2011/12/05 09:16:04 DUAL
117 2011/12/05 09:16:04 DUAL
280 2011/12/05 09:19:09 MAP_OBJECT
365 2011/12/05 09:19:10 SYSTEM_PRIVILEGE_MAP
367 2011/12/05 09:19:10 SYSTEM_PRIVILEGE_MAP
368 2011/12/05 09:19:10 TABLE_PRIVILEGE_MAP
370 2011/12/05 09:19:11 TABLE_PRIVILEGE_MAP
371 2011/12/05 09:19:11 STMT_AUDIT_OPTION_MAP
373 2011/12/05 09:19:11 STMT_AUDIT_OPTION_MAP
10 rows selected.
SQL>
SQL> declare
2 rowArray TestTabLib.TTestTab;
3 begin
4 --// populating the array - using a custom build
5 --// loop example such as a Java front-end will
6 --// use reading data from user input form
7 rowArray := new TestTabLib.TTestTab();
8 rowArray.Extend(2); --// user entered 2 values
9 for i in 1..rowArray.Count loop
10 rowArray(i).id := i;
11 rowArray(i).day := trunc(sysdate);
12 rowArray(i).val := 'value '||to_char(i,'000');
13 end loop;
14
15 --// bulk insert array
16 TestTabLib.InsertRows( rowArray );
17 end;
18 /
PL/SQL procedure successfully completed.
SQL>
SQL> select * from testtab where val like 'value%';
ID DAY VAL
1 2013/01/21 00:00:00 value 001
2 2013/01/21 00:00:00 value 002
SQL> -
Adding data from an array to a table
How can i add information from an array to a table via JDBC? I have tried:
stmt.executeUpdate("INSERT INTO TEMP " + "VALUES (" + carData[0] + ", " + carData[1]);
but i get the error:
SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
Also, can i only add data to some columns of a row and not all?If your TEMP table has only two columns and both of
them are of number
types, and your array contains only numeric types
(int[], long[] etc., it should not be a problem.
If your table contains more than two columns (and the
remaining columns are nullable) you need to list the
column names in the insert statement. Check your table
definition in the database and see SQL syntax for
insert.
If your columns are of string type, you need to
enclose the values in quotes (alternatively, use
PreparedStatement).I agree with this.
Here is the syntax that he was talking about
//if the values are numeric
stmt.executeUpdate("INSERT INTO TEMP(<COLUMN NAME>,<COLUMN NAME>) "
+ "VALUES(" + carData[0] + "," + carData[1] + ")";
//if the values are text
stmt.executeUpdate("INSERT INTO TEMP(<COLUMN NAME>,<COLUMN NAME>) "
+ "VALUES('" + carData[0] + "','" + carData[1] + "')";
Notice that the last part of your original query was incorrect. You forgot to put the bracket in quotes again.
Maybe you are looking for
-
Java.lang.NullPointerException after setDisabled(false);
Trying to execute it.setDisabled(false) or it.setReadOnly(false) i get: ava.lang.NullPointerException ADF_FACES-60097:For more information, please see the server's error log for an entry beginning with: ADF_FACES-60096:Server Exception during PPR, #1
-
the Yahoo tab is a white box after the +tab... when the plus tab is selected it brings up a 'Yahoo!' search window not a new google window... I can not find anything for yahoo on ether google or FF... or in my computer software, even went thru regedi
-
Dear Experts, I'd like to select the ship to address different from default location. Then, I added the two address from Business Partner Data. But, I can't select the other address. I can only select the default address. So, please give me some advi
-
F4M document contains errors - URL missing from Media tag
I feel like I'm getting close to finally get a live stream to work correctly in 4.5 I can see the streams being recorded in the following directories C:\FMSHOME\applications\livepkgr\streams\_definst_\liveevent1 C:\FMSHOME\applications\live
-
Hyperion Business Rule Error: Cannot retrieve connected root element for
Hi, I am trying to open a business rule in EAS and I am recieving the following error: Cannot retrieve connected root element for Planning/Servername/Application/Database. I am able to connect to the application via Planning Web, but I am recieving t