2D-Array as input vi
Hi,
How can I have a 2D-Array as an input of my vi?
I want from one vi pass a 2D-Array as a parameter to another vi. How can I do it?
I define an input in my vi as a 2D-Array but LabVIEW tell me that this input (2D-Array)has a undefined type.
Thanks
Big time bug. When I read it just now I forgot that he was using a combo box. I'm so used to enum and dialog rings Here's how it should be. This is okay when you use values of 1, 2, and 3. It gets a bit trickier with values that jump around which is why I almost always use an enum.Message Edited by Dennis Knutson on 03-22-2005 03:17 PM
Message Edited by Dennis Knutson on 03-22-2005 03:17 PM
Attachments:
combo box.jpg 13 KB
Similar Messages
-
Data Federator - Array as input to web service.
Hi,
I have an ASP.NET web service method that takes in an array of string for input. I am adding this web method as a data source in Data Federator. However when I look at the method's parameters in Operations Selection in Data Federator, the array of string becomes a string. It seems that Data Federator only passes one element value as an array to the method. Is there any way for Data Federator to see the array correctly so that I can pass an array of string to the web method via Data Federator?
Thanks.hi,
Data Federator does not support array types as input parameters. For the moment there is no Data Federator workaround for this limitation (the only possibility is to modify the WebService definition).
thanks. -
Java Mapping with an xml array as input
Hi Gurus,
I have to perform a java mapping to map some input xml contained in an array with a target message type. I have found a good java mapping example here:
Re: Please provide Java Mapping example
but my mapping input is not a single XML, but an XML array, thus I have a doubt...
How can I map multiple XML contained in an array with a target XML? I have to solve this problem into a Java mapping prospective.
Thanks to all!
Message was edited by:
Gabriele MorganteHey Stefan, I think he is refering to a n:1 multimapping.
If that is indeed the case, Gabriele, you will have to consider the initial tags inserted by mapping runtime to treat multimappings.
Suppose your XML message is like
<myMT xmlns="urn:mynamespace">
<value>xpto</value>
</myMT>
Then, if your source message interface occurrence is defined as unbounded in your interface mapping, your mapping program (message mapping, xslt, java mapping, whatever) will receive, from mapping runtime, a message like this:
<Messages xmlns="http://sap.com/xi/XI/SplitAndMerge">
<Message1>
<myMT xmlns="urn:mynamespace">
<value>xpto1</value>
</myMT>
<myMT xmlns="urn:mynamespace">
<value>xpto2</value>
</myMT>
<myMT xmlns="urn:mynamespace">
<value>xpto3</value>
</myMT>
</Message1>
</Messages>
Also, if you have more than 1 message type as source of your interface mapping, your mapping program will receive the other message types in <Message2>, <Message3>... tags.
The <Messages> and <MessageX> tags will always be automatically generated by mapping runtime when dealing with multimappings, which are mappings from m XML messages to n XML messages, with either m, n or both different of 1 (note that this definition includes mappings from 1 type to 1 type, when either source, target or both message types have max occurrence = ubounded).
Finally, remember that the output that your mapping program generates will also have to include these <Messages> and <MessageX> tags (with proper namespace), since mapping runtime will be expecting them. Message mappings treat those by default, but your xslt and java multimappings will have to explicitely include these tags in the output.
Regards,
Henrique. -
How build a function with an array in input and another array in output
Hi, I need to create a function, which receive in input a list of Group's name and retrieve the correspondent list of Group's id.
So I need to have these conditions:
1) The parameter in input has to be only one "p_user_name" (an array of values)
2) the return parameter has to be p_user_id (array of values)
3) in the WHERE condition p_user_name has to be used in order to retrieve the list of user_id I need
Following, a little example:
FUNCTION get_group_id (p_user_name IN VARCHAR2) RETURN p_user_id
IS
BEGIN
SELECT group_id FROM jtf_rs_groups_vl
WHERE group_name = p_user_name
RETURN p_user_id;
END get_group_id;
I think I have to create a new type with p_user_name, but I don't know after, how to join group_name (varchar2) with p_user_name.....
Anybody can help me to find the light ?
Thanks in advance
AlexI need to create a function, which receive in input a list of Group's name and
retrieve the correspondent list of Group's idAt the beginning the argument "p_user_name IN VARCHAR2" is not what you need. You should create global type - nested table of varchar2 values where you
can keep the list of names. And you also need to create nested table of numbers
to return IDs (if you really need collection but not ref cursor !):
SQL> select empno, ename from emp;
EMPNO ENAME
7369 SMITH
7499 ALLEN
7521 WARD
7566 JONES
7654 MARTIN
7698 BLAKE
7782 CLARK
7788 SCOTT
7839 KING
7844 TURNER
7876 ADAMS
7900 JAMES
7902 FORD
7934 MILLER
14 rows selected.
SQL> create type d_v is table of varchar2(10);
2 /
Type created.
SQL> create type d_n is table of number;
2 /
Type created.
SQL> create or replace function get_ids
2 (names d_v) return d_n
3 is
4 ret_ids d_n;
5 begin
6 select empno
7 bulk collect into ret_ids
8 from emp, table(names) t
9 where ename = t.column_value;
10 return ret_ids;
11 end;
12 /
Function created.
SQL> declare
2 d d_n;
3 begin
4
5 d := get_ids(d_v('KING','ALLEN'));
6
7 for i in 1..d.count loop
8 dbms_output.put_line(d(i));
9 end loop;
10
11 end;
12 /
7839
7499
PL/SQL procedure successfully completed.Rgds. -
PL/SQL Associative Array as INPUT Parameter
Hi,
Just wondering if anyone out there has a good example of how to get VB.NET (using ODP.NET 9.2.0.4) to pass an Associative Array as an Input parameter to a stored procedure (not for bulk binds)? Specifically, I'm looking for an example of how a VB Strong Typed Collection would be passed through the PLSQLAssociativeArray Collection Type.
I've managed to get a test to work by passing a 1-D String Array through the ODP.NET layer to the PL/SQL AssociativeArray parameter. But I've had zero success trying to get the Collection from VB through ODP.NET.
Thanks in advance for any help.
Todd.For example, if I wanted to return a list of customer ids and names into A PLSQL Associative Array, how would I do it. I know how to return a list of customer ids into a PLSQL associative aray using the code below but I have to specify the maximum number of elements and the maximum size of each of the elements. Is there any way around this?
Dim prmOutCustomerIdList As New OracleParameter
With prmOutCustomerIdList
.ParameterName = "oCustomerIdList"
.CollectionType = OracleCollectionType.PLSQLAssociativeArray
.OracleDbType = OracleDbType.Varchar2
.Direction = ParameterDirection.Output
.Size = 5
.ArrayBindSize = New Integer(4) {10, 10, 10, 10, 10}
End With -
Passing array as input to procedure
Hi,
create or replace type t_employee_id is table of number;
create or replace type t_employee_name is table of varchar2(4000);
I have created type for array input.
declare
p_id t_employee_id;
p_name t_employee_name;
begin
p_id(1):=12;
p_name(1):='no22';
p_id(2):=300;
p_name(2):='XXX';
p_id(3):=4;
p_name(3):='bn';
sp_sample(p_id => p_id,
p_name => p_name);
end;
CREATE OR REPLACE PROCEDURE sp_sample(p_id IN t_employee_id,
p_name IN t_employee_name) IS
v_error EXCEPTION;
PRAGMA EXCEPTION_INIT(v_error, -23456);
BEGIN
FORALL i IN 1 .. p_id.COUNT SAVE EXCEPTIONS
INSERT INTO employee
(employee_id, employee_name)
VALUES
(p_id(i), p_name(i));
COMMIT;
EXCEPTION
WHEN v_error THEN
FOR i IN 1 .. SQL%BULK_EXCEPTIONS.COUNT LOOP
dbms_output.put_line('Error:' || SQL%BULK_EXCEPTIONS(i)
.ERROR_INDEX || 'Message' ||
SQLERRM(-sql%BULK_EXCEPTIONS(i).ERROR_CODE));
dbms_output.put_line('\n');
END LOOP;
END sp_sample;By compling the above code I getting error like this
ORA-06531-Reference to uninitialized collection.
Thanks in advance.... and The Holly Book of All PL/SQL Programmers (also known as: Oracle® Database PL/SQL Language Reference) says:
Collection Initialization
Until you initialize it, a nested table or varray is atomically null; the collection itself is null, not its elements. To initialize a nested table or varray, you use a constructor, a system-defined function with the same name as the collection type. This function constructs collections from the elements passed to it.
You must explicitly call a constructor for each varray and nested table variable. Associative arrays, the third kind of collection, do not use constructors. Constructor calls are allowed wherever function calls are allowed.
Example 5-10 initializes a nested table using a constructor, which looks like a function with the same name as the collection type.
Example 5-10 Constructor for a Nested Table
DECLARE
TYPE dnames_tab IS TABLE OF VARCHAR2(30);
dept_names dnames_tab;
BEGIN
dept_names := dnames_tab('Shipping','Sales','Finance','Payroll');
END;
Because a nested table does not have a declared size, you can put as many elements in the constructor as necessary.------------------------------------------------------------------------------------------------------------------------------
It's very abstract and not intuitive but there is a difference between 'the collection is NULL (not initialized)' and 'the collection that is not NULL (initialized), but it has no elements' and 'the collection that has all elements NULL'. If you declare a variable of VARCHAR2(30) datatype then Oracle will allocate memory for this variable. However if you have a variable of a collection type then simply declaring it is not enough - you have to call a constructor so Oracle can allocate memory for this variable before it's first use.
So you can have:
declare
p_id t_employee_id := t_employee_id();
p_name t_employee_name := t_employee_name();
begin
p_id(1):=12;
p_name(1):='no22';
p_id(2):=300;
p_name(2):='XXX';
p_id(3):=4;
p_name(3):='bn';
sp_sample(p_id => p_id,
p_name => p_name);
end;or simply
declare
p_id t_employee_id := t_employee_id (12, 300, 4);
p_name t_employee_name := t_employee_name ('no22', 'XXX', 'bn') ;
begin
sp_sample(p_id => p_id,
p_name => p_name);
end; -
How do I make a continuous X-Y graph with an array as input?
I want to create an X-Y graph with a reference time (double) as one variable and the other is a double data type. How can I create a continuous graph on an X-Y graph with these variables? I have only been using Labview for 2 months so if you have any suggestions please go easy on the technical terms.
TIA,
KevinLabVIEW what several options for displaying data. A waveform chart is great if you receive one point at a time and want to plot the data in series. A waveform graph is good for plotting arrays in a time series fashion. An xy plot is good for connecting points that do not occur in a series. This plot offers the most flexibility in graphing points with different x values.
It is often hard to keep what structure goes two what display option. As a cheat, I right click on the chart in the block diagram and slide the mouse to create >> (either a constant or control). This way you can get a model for the data you want to input.
You may also want to look at the shipping examples that come with LabVIEW. In LabVIEW 6.1, goto help >> find examples >> fundamen
tals >> graphs and charts.
Jeremy Braden
National Instruments -
How to read flushed cluster array from input queue?
Hi! I'm new to LabView. Can someone please help me?
I want to use a subvi to read a queue which I created in another vi. The created queue holds an array of clusters that I want to unbundle in a for loop in the reading vi. But the output of the flush queue function is a string array (since the subvi has no info on what sort of queue is being input).
I can't connect the unbundle function to a string input; can I use the type cast function to force the flush output to be a cluster? Or is there a better way to do this?
And if so, what is the string constant I need to attach to the "type" input in the type cast function?
And also, I'm told that the cluster is kind of like a "struct"; so is there a way to n
ame it so that other vi's know what it is(i.e. type cast)?
jenI did look at the help examples, but I couldn't find one that was sending the queue from one vi to another(well, not any that I could understand), and that was really my problem.
I did get the thing to work when it was all in one vi.
You bring up an interesting point about "dequeue" and "flush". Perhaps I am mistaken, but my reasoning for using flush rather than dequeue was the following:
I am using the queue as a data buffer. I need the queue to hold a few minutes of data. This data is dumped to file upon fault event, i.e. it tells me what was going on right before the fault occurred. I need that queue to dump the data and then immediately turn around and start filling up again. I felt that holding on to the queue reference in the save-to-file routi
ne (which involves lots of potentially slow hard disk access) might cause the object to lock and hence not be able to save right away. I don't know how LabView does threading, but if I was writing the threading routine, I would lock any object which was being executed upon in a routine to prevent data collision.
Of course, this begs the question: does LabView lock all objects in a subroutine that is executing? Or just in the part which is unresolved? or does it lock objects at all? Perhaps I should flush the queue outside of the subroutine anyway, so that the subroutine can happily munch on the flushed array while my queue goes back to the business of collecting data?
Am I way off base in how the threading works?
Thanks!
jen -
Allow boolean arrays as input for "Array Min & Max"
The Array Max & Min function is quite versatile, but for some reason it does not accept boolean arrays. This restriction make no sense at all. Since we can easily sort boolean arrays, this function should work too! It would come in handy for example if looking for the position of a single TRUE in a 2D array (search only works for 1D arrays!). Array min & max would simply return the index pair of the first TRUE found. As a workaround, we currently need to insert a "boolean to 0,1" to get the same effect. This seems unecessary.
> I have to disagree with the need to do this LabVIEW prides itself of function polymorphism, but there are these nagging little holes that give you a broken wire for no obvious reason at all. Sure there are workarounds, but the beginner programmer might construct a horrible Rube Goldberg style workaround, full of duct tape and bailing wire. We can sort boolean arrays so there is a clear order between TRUE and FALSE ---> there is a MAX and a MIN and the function should return it. Note that Array Min&Max even works for string arrays, where it outputs the lexically sorted first and last array element. (Hey, I did not know that, could be useful sometimes!). Not allowing boolean array inputs is an unnatural exception and should be fixed. A similar case is described in this suggestion (which did not get much attention either)
-
Matlab : 3D-array es input of a matlab node
Hello,
I'd like to know if it's possible to pass a 3D-array as an input of a Matlab node ?
I intend to process a stack of images (2D data UINT8) with a Matlab script
The stack of images result of autoindexing of a for loop which builds the 3D-array.
I want to do this because I already have a Matlab node that is executed each iteration of the for loop, which takes a lot of time.
The input matlab node is an array (real matrix) that comes from an image.
If I could put the matlab node outside of the for loop, I hope this would execute faster
Configuration :
LabVIEW 7.1 / Win XP
Matlab 7.0.1
Thanks,
EmmanuelThere are a few ways to deal with this, but it would help to see your code. Are you sending a reference of the Cluster into a VI, or individual references of the checkboxes? It sound like you are not using a strict reference. The workaround, since you know the datatype, is to use Variant to Data and change the variant to a boolean, but this shouldn't be necessary. Again, post some code so we can be more help.
edit: It sounds like you are trying to hard code Radio Buttons. You do know that LabVIEW has Radio Buttons now, right?
Richard -
Incrementing 'index array' row input according to bytes received
I am receiving binary data through a UDP port. I'm reading a column of a spreadsheet and I want to extract the consecutive row everytime a further 4 bytes of data is received. I will use the contents of the spreadhseet cell as a condition to format the binary data. I guess i need to count the bytes of data passed then reset the counter every time it reaches 4. Every time the counter resets the index array contant need to increment by 1...but i don't know how to do this. Can anyone help?
ThanksI tried as you said, it seems to be partially working but there seems to be a problem with the timing. The index increments in steps of one but not quickly enough. The data type sent to the selector terminal does not seem to be in sync with the binary data as my data does not update as i expect. Any ideas how to fix this problem?
vi attached...
Attachments:
UDP_Case_Struct.vi 35 KB -
Arrays as input parameters.
eg. i have a method that takes in matrix2 and matrix3 as input parameters which are both 2D arrarys. Are the below method header alright?
public void matrix1(matrix2,matrix3)this is correct:
public void matrix1(int[][] matrix2, int[][] matrix3) {it doesn't HAVE to be an int, it can be any type you want... -
Comparing elements of array to input
If I read in a letter, or word from the user, how would i be able to compare it to see if it is equal to an item in the array.
ex. In the first slot of the array I have HELLO, and now the user types HELLO, how would I compare it to that item in the array?
thanksif (array[0].equals(stringInputByUser))
-
I am a beginner in C programming and I cannot understand how to use the structures that LabVIEW creates for its arrays in C. Can anyone point me to a good example?
Check the following answer that I posted recently to a similar question.
http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=5065000000080000006D1E0000
Good luck!
Vargas
www.vartortech.com -
I want to convert string to 1-D array to input it to waveform graph?
thanks in advance
Hi oiuuhjoi,
ok, and where's the problem?
Spoiler (Highlight to read)
Ever tried SpreadsheetStringToArray?
Ever tried SpreadsheetStringToArray?
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome
Maybe you are looking for
-
1.Does 9iFS support workflow ? Generally, TO create a document have several step(Edit,Audit,Approve,publish and etc). How can I do this in iFS ? 2.Does 9iFS support XML file Linking ? Usually , I want to link a file to another. When I viewing this fi
-
PSE 8 doesn't work after O/S upgrade
I have used PSE 8 for some time on Windows XP. I recentl "upgraded" to Windows 7, and re-installed PSE 8. After some trouble finding my catalog, I got the organizer to work. However, when I try to switch to the editor, I get a message which says "Lic
-
Callers having trouble hearing me on my 5s
I have only had my phone about two weeks. People I have called or they call me are saying my voice goes in and out or at times sounds like I am in a tunnel. And changes throughout the conversation without me changing my position or how I am holding
-
Installing CS4 on latest iMac 21.5" 2.9GHz, completed but failed to open
It keeps poping up this : Please kindly help, thank you so much.
-
HT203261 I use emojis all the time when I text my girlfriend who owns a Droid 3.
Whenever I send a longer text with an emoji, the text message completely changes to something I sent in the past, thus confusing her. Does anybody else have this problem?