Two dimension string array in teststand
Hello,
I want to pass a two dimension string array from a labWindows dll into Teststand. My labwindows dll:
#define NR_columns 12
#define NR_rows 1200
#define NR_hight 1024
int__declspec(dllexport) __stdcall sort( char pspec[NR_columns][NR_rows][NR_hight])
The call of the dll in teststand looks like the attached picture in the doc file.
and I got the error message which shows the attached second picture in the doc file
what is the problem?
regards
samuel
Attachments:
Error1.doc 94 KB
Hello Samuel,
I'm not experienced in LabWindows but I think the reason for this Error is the dimension of FileGlobals.loadspec in TestStand. The Error Dialog displays for this String Array [0..11][0..1200]. That's an array of 12 and 1201 elements but function is expecting 12 and 1200 elements.
I hope this helps.
Kind regards
C. Dietz
Test Engineering
digades GmbH
www.digades.com
Similar Messages
-
Searching two dimensional string arrays
Hello, I'm very new to Java. I would like some advice on the code below. What I'm trying to do is: I want the user to enter a 9 digit number which is already stored in an two dimensional array. The array is to be searched and the 9 digit number and corresponding name is to be printed and stored for future reference. Something is wrong with my array checking. If I enter the nine digit number, the program errors and asks me again for the number. If I enter 0-4, I receive an output. I just don't know how to compare string array values. Could someone please help me with this?
import java.io.*;
import java.util.*;
public class SocialSn2
public static void main(String args[]) throws Exception
boolean validSSAN = false;
Ssn(validSSAN);
if (validSSAN)
//Ssn(false);//write the code here to continue processing
}//end main
public static void Ssn(boolean Validated)
String[][] employees =
{{"333333333", "Jeff"},
{"222222222", "Keith"},
{"444444444", "Sally"},
{"555555555", "Kaylen"},
{"111111111", "Sheriden"} };
boolean found = false;
while (!found)
System.out.println("Enter the employee's Social Security number.");
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
try
String line = in.readLine();
int input = Integer.parseInt(line); //added
found = false;
for(int j = 0; j < 5; j++)
if(input >= 0 && input <= employees.length)
//if(employees[j][0].equals(input))
//System.out.println(employees[input][0] + employees[input][1]);
found = true;
System.out.println(employees[input][0] + " " + employees[input][1]);
catch (Exception exc)
System.out.println("error");
found = false;
Validated = found;
}//end Ssn
}//end classThere seems to be some problem with your loop for checking those values
if you had used System.err.println() in your catch block you would see that you were getting an ArrayIndexOutOfBoundsException
The following works for me.
import java.io.*;
import java.util.*;
public class SocialSn2
public static void main(String args[]) throws Exception
boolean validSSAN = false;
Ssn(validSSAN);
if (validSSAN)
//Ssn(false);//write the code here to continue processing
}//end main
public static void Ssn(boolean Validated)
String[][] employees =
{{"333333333", "Jeff"},
{"222222222", "Keith"},
{"444444444", "Sally"},
{"555555555", "Kaylen"},
{"111111111", "Sheriden"} };
boolean found = false;
System.out.println(employees.length);
System.out.println(employees[0].length);
while (!found)
System.out.println("Enter the employee's Social Security number.");
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
try
String line = in.readLine();
//int input = Integer.parseInt(line); //added
found = false;
for (int i=0; i< employees.length;i++)
if(employees[0].equals(line))
System.out.println(employees[i][0]+" "+employees[i][1]);
found = true;
catch (Exception exc)
System.err.println(exc);
found = false;
Validated = found;
}//end Ssn
}//end class -
How do I read two dimentional string object in C through JNI
HI,
I am new to JNI and Java as well. I want to read two dimentional string object passed by java to a native method written in C/C++. Say for example I have declared a two dimentional string object as below:
In Java
class InstanceFieldAccess {
private String [][] originalAddress = new String[][13];
private static native String [] accessField(String [][] referenceAddress);
public static void main(String args[]) {
/// Java code to get the string object and pass the string object to native method
new InstanceFieldAccess ().accessField(referenceAddress);
static {
System.loadLibrary("ReadStr");
In C/C++
I want to read the passed two dimentional string array in C/C++ native code and do the further processing and pass the string
back to Java class.
Could anybody tell me how to write the corresponding C/C++ native method.
Thanks in Advance.
Pramod.i got it thanks.
-
Multi-dimensioned global arrays
I'm using a couple of global multi-dimensioned string arrays (they're used in multiple functions throughout the program) and I don't know the boundaries of either dimension until run-time.
It works fine to use the "new" on a single-dimensioned array, but I'm getting a compiler error when I try:
std::string* dta = new std::string[x][y];
Any ideas what the problem is?It works fine to use the "new" on a single-dimensioned array, but I'm getting a compiler error when I try:
std::string* dta = new std::string[x][y];
How do I declare a 2d array in C++ using new?
http://stackoverflow.com/questions/936687/how-do-i-declare-a-2d-array-in-c-using-new
- Wayne -
Show me the code for two dimension array in JSP!
Thanks in advance!Hi,
I am new in Java but maybe I can help you:
Two-dimnsional arrays you can declare in following way:
String[][] someArray;
When you want to allocate space for new array you can do something like this:
someArray = new String[5][5];
All Arrays have a data variable called length, which you can inspect to find out how many elements there are in the array.
For multi-dimensional arrays, each dimension has a length property.
int[] [] a1 = {{ 0, 1, 2 },{ 3, 4, 5 }};
for (int i=0; i < a1.length; i++) {
for (int j=0; j < a1.length; j++) {
prt(i + "," + j + "=" + a1[i][j]);
Hope this is of help to you.
Mirkos -
Selecting one dimension of a two dimension array?
hi, i want to select only one dimension of an array and put it into an arraylist (or casting the array verbatim into the arraylist)
for example, here is an two dimension array:
Object[][] data =
{ { new Date(), "A", new Integer(1), Boolean.TRUE },
{ new Date(), "B", new Integer(2), Boolean.FALSE },
{ new Date(), "C", new Integer(9), Boolean.TRUE },
{ new Date(), "D", new Integer(4), Boolean.FALSE}
};and i want to cast it into an arraylist, what i have in mind (a bit troublesome is the following:)
ArrayList dataArray = new ArrayList();
dataArray.add(data[0]);
dataArray.add(data[1]);
dataArray.add(data[2]);
dataArray.add(data[3]);
System.out.println(dataArray);when come upon the last System.out.println, i got some seemly useless addresses:
[[Ljava.lang.Object;@f73c1, [Ljava.lang.Object;@789144, [Ljava.lang.Object;@1893efe, [Ljava.lang.Object;@186c6b2]
how do you accomplish casting a two dimension array into an arraylist, but the second dimension of the arraylist is kept as Array of Objects? thanks alot!First, the strings that are printed out are the value of the hashcode for the specific object. That is the default value that is printed out for any object reference in a class that inherits the toString() method from the Object class. This is true for arrays. Your ArrayList contains array references in it..
So, you are printing the object hashcodes for the arrays in your ArrayList, instead of the contents of those arrays. It would be better if you created ArrayLists, or even designed an object that stores your data, and stored those inside your ArrayList. ArrayList has an overwritten toString() method that will print the contents instead of the object hashcode, so an ArrayList containing ArrayLists would print your data the way you want. If you define your own class, you will need to provide a toString() method that prints the contents the way you want.
PS, look at http://java.sun.com/j2se/1.5.0/docs/api/java/util/AbstractCollection.html#toString() for more information on the toString() method used by ArrayList.
� {� -
Matrix in java using two dimension array
hi!
Everybody here's a problem I have cpould any body out there give nice piece of sourcr code for "matrix in java using two dimension array"I have to give a presentation how it works.Yes I'd appreciate as many example as possible
If anybody can??
Please help
regards
ardentnice piece of sourcr
code for "matrix in java using two dimension
n arraySure,
int[][] matrix = new int[5][5];
That declares a two-dimensional 5 by 5 array with integer elements. All elements are initially 0.
For further information check you favourite Java textbook. -
How to call a CString array from TestStand
I have a C++ DLL that uses a CString array, CString myString[ ], that I need to pass back to TestStand 4.0 for inclusion in my results database.
In the TestStand module definition the parameter argument Description comes up as a CStriing pointer (CString*) instead of a CStringArray.
When I put my array of strings into the Value Expression I get an error: Expected String, found Array of Strings.
I have no trouble passing just a string pointer but that's not working either.
Can someone help?
Thanks,
Steve SHi Steve,
I don't think that you can pass a CString Array from C++ DLL to TestStand 4.0 directly.
But you can do it another way: concatenate all Strings by a delimit in your CString Array to build a new String, then pass it to TestStand. In TestStand you can separate those Strings by the delimit, and rebuild a String Array.
For example:
// If this is your CString Array.
CString myString[] = {"AAA", "BBB", "CCC"};
// Build a new String in your C++, and pass it to TestStand.
char *myNewString = "AAA~BBB~CCC";
// Separate myNewString and build an Array in TestStand...
Hope that can help you!
Message Edited by My NI on 11-29-2007 11:34 AM
Regards
MY -
How can I use two single-dimensional arrays-one for the titles and array
I want to Use two single-dimensional arrays-one for the titles and one for the ID
Could everyone help me how can i write the code for it?
Flower
public class Video
public static void main(String[] args) throws Exception
int[][] ID =
{ {145,147,148},
{146,149, 150} };
String[][] Titles=
{ {"Barney","True Grit","The night before Christmas"},
{"Lalla", "Jacke Chan", "Metal"} };
int x, y;
int r, c;
System.out.println("List before Sort");
for(c =0; c< 3; ++c)
for(r=0; r< 3; ++ r)
System.out.println("ID:" + ID[c][r]+ "\tTitle: " + Titles[c][r]);
System.out.println("\nAfter Sort:");
for(c =0; c< 3; ++c)
for(r=0; r< 3; ++ r)
System.out.println("ID:" + ID[c][r]+ "\tTitle: " + Titles[c][r]);This is one of the most bizarre questions I have seen here:
public class Video
public static void main(String[] args) throws Exception
int[] ID = {145,147,148, 146,149, 150};
String[] Titles= {"Barney","True Grit","The night before Christmas", "Lalla", "Jacke Chan", "Metal"};
System.out.println("List before Sort");
for(int i = 0; i < Titles.length; i++)
System.out.println("ID:" + ID[i]+ "\tTitle: " + Titles);
System.out.println("\nAfter Sort:");
for(int i = 0; c < Titles.length; i++)
System.out.println("ID:" + ID[i]+ "\tTitle: " + Titles[i]);
Generally you don't use prefix (++c) operators in you for loop. Use postfix (c++).
Prefix means that it will increment the variable before the loop body is executed. Postfix will cause it to increment after. -
String Array Constant Addition
Is there an elegant way of marking the last element in a string array
constant? i.e. I take an Array constant, and add a simple string to it,
so that it becomes a String Array Constant. Now I add elements 1 and 2
and 3. But now I want to take element 3 out. If I just delete Element 3
contents from the string control, that is fine, but the # of Array
elements is still 3. It is just that the 3rd elelment is null. How can I
make the array length 2? Now I know that starting over is one option
(just creat a new array constant, and add the two elements) but what if
my array constant has 100 elements and I want to make it 99. I also
know that programatically I can remove these elelents, but I am taking
about in the programming of th
is constant. I must be over looking
something... Any ideas???
Sent via Deja.com http://www.deja.com/
Before you buy.[email protected] wrote:
> Is there an elegant way of marking the last element in a string array
> constant? i.e. I take an Array constant, and add a simple string to it,
> so that it becomes a String Array Constant
Arrays must be all the same type. If the last element is a constant, all
elements are
> Now I add elements 1 and 2
> and 3. But now I want to take element 3 out. If I just delete Element 3
> contents from the string control, that is fine, but the # of Array
> elements is still 3. It is just that the 3rd elelment is null.
In a string, yes, Empty strings are essentially nulls.
> How can I
> make the array length 2? Now I know that starting over is one option
> (just creat a new array constant, and add the two elements) but what if
> my array cons
tant has 100 elements and I want to make it 99. I also
> know that programatically I can remove these elelents, but I am taking
> about in the programming of this constant. I must be over looking
> something... Any ideas???
This is one of my problems. It is easy to size an array up, but hard to size
down.
Of course you can resize at run time but the only way I know to do this
when editing is to start over.
Kevin Kent
Attachments:
Kevin.Kent.vcf 1 KB -
Converting vector to string array
How can I convert values in a vector into a string array?
Vector formsVector = new Vector();
while (rs.next())
{formsVector.add(rs.getString("forms"));}
String forms[] = (String[])formsVector.toArray();
I tried the above line but it did not work. Any input please?
Thanks.... What is the difference between the two as
according to online help, both are same.
String forms[] = (String [])formsVector.toArray();
String forms[] = (String [])formsVector.toArray( new
String[0] );The difference lies in the type of the object returned from toArray. The first form you list, formsVector.toArray(), always returns an Object[]. In your example, you'll get a ClassCastException at runtime when you cast to String[].
The second form will try to use the array you pass in. If it's not big enough, it'll create a new one of the same type as that array. This is what's happening when passing a zero-length array into toArray.
My personal preference is to save an extra instantiation and build the array to the proper size to begin with:String forms[] = (String [])formsVector.toArray( new String[formsVector.size()] ); -
Help with a store function that takes string array
Hi All,
I have a function that takes in two string arrays, status_array, and gender_array. You can see the partial code below. Somehow if the value for the string array is null, the code doesn't execute properly. It should return all employees, but instead it returns nothing. Any thoughts? THANKS.
for iii in 1 .. status_array.count loop
v_a_list := v_a_list || '''' || status_array(iii) || ''',';
end loop;
v_a_list := substr(v_a_list, 1, length(trim(v_a_list)) - 1);
for iii in 1 .. gender_array.count loop
v_b_list := v_b_list || '''' || gender_array(iii) || ''',';
end loop;
v_b_list := substr(v_b_list, 1, length(trim(v_b_list)) - 1);
IF v_a_list IS NOT NULL and v_b_list IS NOT NULL THEN
v_sql_stmt := 'select distinct full_name from t_employee where status in (' || v_a_list || ') and gender in (' || v_b_list || ')';
ELSIF v_a_list IS NOT NULL and v_b_list IS NULL THEN
v_sql_stmt := 'select distinct full_name from t_employee where status in (' || v_a_list || ') ';
ELSIF v_a_list IS NULL and v_b_list is not null THEN
v_sql_stmt := 'select distinct full_name from t_employee where gender in (' || v_b_list || ')';
ELSE
v_sql_stmt := 'select distinct full_name from t_employee';
END IF;
OPEN v_fullname_list FOR v_sql_stmt;
RETURN v_fullname_list;I'd first recommend trying to avoid the dynamic sql.
use an approach like
[http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:210612357425] or
[http://stackoverflow.com/questions/1625649/oracle-parameters-with-in-statement/1655743#1655743] or [http://stackoverflow.com/questions/1715978/how-to-use-an-oracle-associative-array-in-a-sql-query]
but if that isn't in scope, do a
dbms_output.putline(v_a_list) ;
dbms_output.putline(v_b_list) ;
dbms_output.putline(v_sql_stmt) ;around and see what it emits -
Saving string array in Standard State Machine.
I use a Standard State Machine to control a laser unit with multiple lasers. When I give the unit a command, it gives me much information back. When LabVIEW is reading this information, it is putting it in a string array.
But the program shows only the information in the array when I enable 'Highlight Execution'. What do I have to do to solve this problem?
Thanks for all commands,
Bjorn
Attachments:
StandardStateMachine 1.vi 26 KB
statemachine.ctl 5 KBDoes your device use a termination charcter at the end of each transmission? You are already set up to use 0xA as a termination character (default on the Configure Serial Port). If so, do not do the big mess with the checking of bytes at port and what not. Just use a VISA Read with a very large number for the bytes to read. The read will complete when that termination character is reached.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
Why does the last line cause a ClassCastException?:
Vector vector = new Vector();
vector.add("One");
vector.add("Two");
vector.add("Three");
vector.add("Four");
vector.add("Five");
String[] array = (String[])vector.toArray();
Thanks
[email protected]Because toArray () creates an Object array. You need the toArray(Object[]):String[] array = (String[]) vector.toArray (new String[vector.size ()]);Kind regards,
Levi -
Can any one tell me how to get the no. of rows and no. of columns in an string array.
ie if i have array like
1 2 3 4
4 5 6 5
7 8 9 6
in an a[][]. how to fine values ie row =3 and col = 4Assuming that the array is a rectangle (all rows have the same number of columns) and that it's two dimensional, you can do this:
int row = a.length;
int col=a[0].length;
I think that works, try it
Maybe you are looking for
-
Missing Set Types in CRM 5.0
Hi Gurus, We are trying to create hierarchy/category in our standalone CRM 5.0 system. However, after creating a new (base) category under the hierarchy we created (no other hierarchy in system), we cannot find the text-related set types (COMM_PR_LGT
-
I can't upgrade an app on my macbook pro it says the connection to the internet has failed
Hello I'm trying to upgrade a game in my macbook pro when I enter the app and says upgrade I click on it a msg shown said that the connection to the internet has failed and I'm using safari and everything is good
-
Adobe Reader X error When I save as a PowerPoint file to PDF and open it with Adobe Reader, the following message pop up: "An error exists on this page. Acrobat may not display the page correctly. Please contact the person who created the PDF documen
-
Extracting text to Unicode (Korean, Japanese, ...)
Hi, I am using the PDFWordFinder to extract text from PDFs in Unicode. This works fine for a lot of documents, even with Japanese, Korean, Chinese ones. But, I have some documents, using Korean fonts, which do not seem to be 'compatible' with the PDF
-
SSRS in SharePoint2013: There is a report in SharePoint and it contains a sub-report and the sub-report hyperlink. When I click the hyperlink to go to the sub-report, after >10min, I click the "Back to.." button on IE to go to the previous page. Then