Split a string and give dat to 4 meters on a
I use the serial port for the acquisition of data with labview.
serial port sends a string of decimal numbers as
203,200,210,230
now, I want to break these chains. I used the stop ther (comma) in Visa character configure serial port vi
But now, I want to read Visa to divide these numbers so that I will give them 4 meters.
For example 203 in the first meter, 200 meter second, 210 to the 3rd and 230 to 4 meters
Hi number,.
Well, it's a colourful façade. What should we do with this photo?
Use a SpreadsheetStringToArray function with ',' as a separator to transform your string in an array of numbers. Then use IndexArray to index the individual numbers in the table:
Tags: NI Software
Similar Questions
-
Write the header and mixed data on the worksheet
Hello world
I'm having some problems with writing my data in a spreadsheet file... Basically, I chewed my data and got the values that I want... When I stop the loop I want data saved in a spreadheet... The first line must be a header, and the lines below should be the corresponding data, consisting of a string and numeric data. See the example below.
Topic name, Max Force (N), means Force (N), Min Force (N);
David, 2134, 23, 284;
Phil, 1234, 43, 321;
Tina, 4059, 335, 55;Can someone please help with this?
Kind regards
Jack
This will create a queue (test.csv), check if file exists(no:_creates_header_plus_data...if_yes:appends_data_only):save to a folder first... vi test.csv will be saved in this folder also.
-
split a string into pl/sql
Hello
How to split a string and store in an associative array in pl/sql.function
My string like this
'1102,1101,1012,1011,1010,1009,1008,1007,1006,10005,1004,1003,1002,1001'
and assign it to the array list. According to
can someone please help
concerning
rYou can try the following. Although I recommend, it would be better to write the function code php as a java stored procedure parser and use the result. We have a class defined in Java String Tokenizer.
-- Define function to split string into tokens FUNCTION get_token( p_input_string IN VARCHAR2, -- input string p_token_number IN PLS_INTEGER, -- token number p_delimiter IN VARCHAR2 DEFAULT ',' -- separator character ) RETURN VARCHAR2 IS v_temp_string VARCHAR2(32767) := p_delimiter || p_input_string ; v_pos1 PLS_INTEGER ; v_pos2 PLS_INTEGER ; BEGIN v_pos1 := INSTR( v_temp_string, p_delimiter, 1, p_token_number ) ; IF v_pos1 > 0 THEN v_pos2 := INSTR( v_temp_string, p_delimiter, 1, p_token_number + 1) ; IF v_pos2 = 0 THEN v_pos2 := LENGTH( v_temp_string ) + 1 ; END IF ; RETURN( SUBSTR( v_temp_string, v_pos1+1, v_pos2 - v_pos1-1 ) ) ; ELSE RETURN NULL ; END IF ; EXCEPTION WHEN OTHERS THEN RAISE; END get_token; -- Call the above function in loop for a string with N tokens DECLARE TYPE assoc_arr_str_typ IS TABLE OF VARCHAR2(100) INDEX BY PLS_INTEGER; str_arr assoc_arr_str_typ; v_str VARCHAR2(200) := '1102,1101,1012,1011,1010,1009,1008,1007,1006,10005,1004,1003,1002,1001' ; v_token VARCHAR2(4) ; i PLS_INTEGER := 1 ; BEGIN LOOP v_token := get_token( v_str, i , ',') ; EXIT WHEN v_token IS NULL ; dbms_output.put_line( v_token ) ; str_arr(i) := v_token; i := i + 1 ; END LOOP ; END ; /
Published by: GG 24 March 2011 09:51
-
Is any String variable or something that have entry and exit data?
Is any String variable or something that have entry and exit data?
I give it up! Everything is too complicated for me I want you to focus on the typical programming language.
-
How to read a combination of strings and data data file
Hello
I'm having the combination of strings and datas to read a data file. I'm reading the file name, the time constants and comments in four indicators separate string (lines for comments varies for different files). And read the data in a 2D array. How can I do this? Y at - it a function that can serch of special characters in the spreadsheet file, so I can locate exactly where I should start reading the specific data. Here's how the data file is displayed. Thank you very much.
Best,
Richard
filename.dat
14:59 12/31/2009
--------------------------------------------------
Sample = 2451
Frequency = 300, time of waiting = 2500
Temperature = 20
--------------------------------------------------
a few comments
a few comments
a few comments
a few comments
a few comments
--------------------------------------------------7.0000E + 2 1.5810E - 5
7.0050E + 2 1.5400E - 5
7.0100E + 2 1.5500E - 5
7.0150E + 2 1.5180E - 5....
Here's a (big) hint.
I would like to give you an excerpt, but I've not updated this machine yet. It's a pretty boring delimiter, if you know what's good for you, you start to use commas, tabs or simple spaces (my order of preference). It is far too easy start add or remove spaces and then you need to use more complex methods to obtain data from worksheet.
-
Concatenate and split the string
Hi all
Is there some how we can split the string like this "1 | ~ | Diego | Maradona | ~ | Footballer | The Argentina.
in the table of 3 elements: '1', ' Diego | Maradona', ' football '. The Argentina.
Here is my code
and put it is:public static void main(String args[]){ System.out.println("========USE SPLIT========== " ); String data = "1 |~| Diego|Maradona |~| Footballer|Argentina"; String[] items = data.split(" |~| "); for (String item : items) { System.out.println("item = " + item); } StringTokenizer tok = new StringTokenizer(data," |~| "); System.out.println("========USE TOKENIZER========== " ); while(tok.hasMoreElements()){ System.out.println("item = " + tok.nextToken()); } }
= USE SPLIT =.
Item = 1
Item = |
Item = |
Item = Diego | Maradona
Item = |
Item = |
Item = football | Argentina
= USE TOKENIZE =.
Item = 1
Item = Diego
Item = Maradona
Item = footballer
Item = Argentina
Published by: mycoffee on February 1, 2011 06:49Split() takes a regular expression. ' | ' has a special meaning in regular expressions.
Try to use
" \\|~\\| "
as the argument of split()
-
split a string using any delimiter and display a table
Hello
I'm trying to split a delimited string and an array of the output results.
I come from a background of .net and c# code I would use would be
Dim myString As String = "mystring\r\nto\r\nsplit";
String [] myString = mystring. Split (newchar [] {'\n', '\r'}, StringSplitOptions.RemoveEmptyEntries);
The code above have a line of muli on the input string (where the \r\n) and the output of a table with the following content
'mystring '.
« à »
'split '.
In addition, I would like to also support comma-delimited files.
I used the string function
"Spreadsheet String To Array" that works well enough for the lines of delimited by commas, but not when the delimiter is something funky like '\r\n '.
vi.llb in the advanced channel folder there are some goodies that do not surrender to the Kroatiens
-
Cannot open JPEG files. Computer to the word when attempted and gives the unreadable code strings. Corrective action?
The file association seems to be incorrect. To rememdy this...
Right-click on any jpeg and select 'Open with' in the menu.
From there, you should have several options, select Windows Picture Veiwer or anything that makes sense on your pc.
If it opens correctly, close it, and then right-click again.
Rather than choose the same program, at the bottom you should see "Choose program" click on it and select the application that worked, then check the box that says "always use the program selected to reopen this file type."
OK out of there and you should be good to go.
-
When I import pictures using windows import camera it gives all my videos the date where I imported them and not the date, I took them. they come out well on my camera. So if I copy and paste it, it gives the correct date. except that I want to use Windows import not only to copy and paste! Help, please!
If you import data, this file of date data, show the date of importation.
I use another program to copy pictures from the camera to the PC and gives the dates of importation and the device date.
-
SQL / PLSQL to split the string into pieces
Hi all
I have a problem of data conversion from the name of one table to another structure.
for example
SQL > desc names
Name Null? Type
----------------------------------------- -------- ----------------------------
TITLE VARCHAR2 (5)
FNAME VARCHAR2 (20)
LNAME VARCHAR2 (20)
SQL > Data desc
Name Null? Type
----------------------------------------- -------- ----------------------------
FULLNAME VARCHAR2 (50)
Insert in data values ("SIR I HAVE ONE NAME PARTICULARLY LONG INDEED");
Insert in the data values ("MINE IS EVEN MORE, ENOUGH RIDICULEMENT so IN FACT");
Essentially, I need to divide these names long, stored in the 1 field, in the above 3 fields. The trickiest part is however I want to do it in such a way so that if the 1st part of the name fits the 1 5 char field I want to do, otherwise I would divide between 2 fields - once again without splitting a string. The reason behind this is that application will automatically put a space between each field when they appear and I would avoid gaps in the names if possible.
This baffled me a little if any help would be seriously great... it might not even be a go-er, as it might be too uneconomic with the amount of available space, but I would give it a shot.
Thank you!
AdamHi, Adam.
Use regular expressions:
INSERT INTO names (title, fname, lname) SELECT RTRIM (REGEXP_SUBSTR ( fullname , '^.{1,5} ' ) ) , REGEXP_REPLACE ( fullname , '(^.{1,5} )?' || -- \1 = optional 1-5-letter word(s) '(.{1,20})' || -- \2 = 1-20 letters '(( .*)|$)' -- \3-\4 = space (plus anything) or end , '\2' ) , REGEXP_REPLACE ( fullname , '(^.{1,5} )?' || -- \1 = optional 1-5-letter word(s) '(.{1,20}( |$))' || -- \2-\3 = 1-20 letters and space or end '(.{1,20})?' || -- \4 = 0-20 letters '(( .*)|$)' -- \5 = space (plus anything) or end , '\4' ) FROM data_table -- data is not a good name ;
Published by: Frank Kulash, August 18, 2009 11:13
Revised to manage long single word fullname -
Compress and decompress data using GZip
Hello
I compress and decompress data on Blackberry 8100 device using the GZip algorithm.
I use following code:
try { GZIPOutputStream gCompress = null; try { ByteArrayOutputStream compressByte = new ByteArrayOutputStream(); gCompress = new GZIPOutputStream(compressByte,9); gCompress.write(inputstring.getBytes()); //gCompress.flush(); compressedBytes = compressByte.toByteArray(); System.out.println("compressedBytes : " + new String(compressedBytes)); compressedString = new String(compressedBytes); } catch (IOException ex) { ex.printStackTrace(); } } catch (Exception e) { e.printStackTrace(); }
The server is unable to decompress data.
Help, please.
Thank you very much.
I think you do a byte to the conversion of the string which you should not do and which may be screwing up your data. The output of compression is not likely to be easily represented by Unicode characters and you want to transmit the bytes, so I think that is not necessary.
This is a reformulated version of the sample in the API, which seems inaccurate, in any case: give it a try and remember that you can send the bytes, not characters.
public static byte[] compress( byte[] data ) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); GZIPOutputStream gzipStream = new GZIPOutputStream( baos, GZIPOutputStream.COMPRESSION_BEST, GZIPOutputStream.MAX_LOG2_WINDOW_LENGTH ); gzipStream.write( data ); gzipStream.close(); return baos.toByteArray(); } catch(IOException ioe) { return null; } }
-
How to split a string into several substrings parent using a delimiter
Hello
I am forced to split a string into several substrings parent using a delimiter.
And insert these substrings in variuou of the columns of a table in a row.
For example. The sting is: ABC * DEF * GHI * JKH *.
where ' *' is the separator.
Desired output:
Col1 Col2 Col3 Col4 Col5
------- -------- -------- ------- ---------
JKH GHI ABC DEF (null)
Could you please guide me how can I achieve this.
Thank you
Bogoss
Hello Salim,
Leave the thread for reference... got this excerpt:
with t as
(
Select "c: its: hgfd:1:23" Str
)
Select
REGEXP_SUBSTR (str, ' ([^:] *)(:|$)', 1, 1, null, 1) col1
, REGEXP_SUBSTR (str, ' ([^:] *)(:|$)', 1, 2, null, 1) col2
, REGEXP_SUBSTR (str, ' ([^:] *)(:|$)', 1, 3, null, 1) col3
, REGEXP_SUBSTR (str, ' ([^:] *)(:|$)', 1, 4, null, 1) col4
, REGEXP_SUBSTR (str, ' ([^:] *)(:|$)', 1, 5, null, 1) col5
t;
This code snippet works well, but for the fixed columns. Here are 5 predefined columns.
But I need to have a logic that I can browse the string any No.. sometimes.
For example. If I get 3 secondary channels of the parent chain... I need to insert into 3 columns.
And if I get 6 strings under... I need to insert into 6 columns.
Could you please help me develop a logic like that.
I use Oracle database 10g.
And the data are currently being collected on external table... but I can store in a variable or a column of a database table.
Thank you
Bogoss
-
Split a string when a url is found
Hello
I am trying to find a URL within a string and it (the text before the link itself and the following text) divided into distinct parts. I tried the split (...) method, but never adds the URL as one of the parts of the split. Is it possible to do? That's what I'm currently using:
I can't understand how to split like that, but I tried this, which works, just not as I want (showing the first part, end of game and the link):public static List<String> findUrls(String input) { List<String> result = new ArrayList<String>(); Pattern pattern = Pattern.compile("\\(?\\b(http://|www[.])[-A-Za-z0-9+&@#/%?=~_()|!:,.;]*[-A-Za-z0-9+&@#/%=~_()|]"); Matcher matcher = pattern.matcher(input); while (matcher.find()) { result.add(matcher.group()); } return result; }
public void findUrl(String input) { String[] test = input.split("\\(?\\b(http://|www[.])[-A-Za-z0-9+&@#/%?=~_()|!:,.;]*[-A-Za-z0-9+&@#/%=~_()|]"); for (int i = 0; i < test.length; i++) { System.out.println(test);
}
}
System.out.println (Regex.findUrl ("just testing http://www.google.com/ this split of the string"));The output I get when doing the findUrl(...) method is:
just testis
This string of splitAny suggestions or help? Thanks, aeternaly
It's ugly, and I know there's a way easier and cleaner to do and I don't know if that's what you want, but you may be able to use it as a starting point:
"xxx abc xxx def xxx xxx ghi jkl xxx".split("((?<=xxx)\\s++)|(\\s++(?=xxx))") // gives ["xxx", "abc", "xxx", "def", "xxx", "xxx", "ghi jkl", "xxx"]
where xxx is your URL scheme. You can keep the spaces around your matches to that model you rid of occurrences of {noformat} \\s++ {noformat}, but this also includes the empty string at the beginning of the sequence and the spaces between the consecutive games:
["", "xxx", " abc ", "xxx", " def ", "xxx", " ", "xxx", " ghi jkl ", "xxx"]
Also, I think that your URL scheme is too complex. Why not use something much more simple that will work in the majority of cases?
pat = "(http://|www\\.)\\S++" input = "http://www.google.com/a/b?c=d&e=f abc www.bibblebobble.net def ghi www.bibblebobble.net http://honkhonk"; input.split(String.format("((?<=%s)\\s++)|(\\s++(?=%s))", pat, pat)) Result: ["http://www.google.com/a/b?c=d&e=f", "abc", "www.bibblebobble.net", "def ghi", "www.bibblebobble.net", "http://honkhonk"]
Although I suspect that's what you were trying to do, but maybe you didn't know that you could use
\S
means "anything but a space" and
+
to mean "one or more".
http://download.Oracle.com/javase/tutorial/essential/regex/
http://www.regular-expressions.info/tutorial.htmlEDIT: I probably account for the https protocol and ignore case. Must be something like that, but I have not tested:
pat = "(?i)(http(s?)://|www\\.)\\S++"
Edited by: jverd August 6, 2011 14:09
-
divide the string and replace the token
Hi all
I have a field called "FreeText" that contains data that is more or less according to the following format.
"1 NEWTON/ISAACSIR WITHOUT DAIRY AND PEANUT PREFER ONE REGIME FRUITS"
It contains the name of a text followed by someone. I want to this tokenized by using space as the delimiter and the first token can separate from the rest of it. The expected output would be two columns containing.
"1 NEWTON/ISAACSIR" and the second column
"NO DAIRY AND NO PEANUT PREFER ONE REGIME FRUITS."
Thanks and greetings
CrusoeReplace with your channel:
It splits the string for 2 values separated by the character of the first found SPACE.WITH abc AS (SELECT '1NEWTON/ISAACSIR NO DAIRY PRODUCTS AND NO PEANUTS PREFERS A FRUIT ONLY DIET' A FROM dual) SELECT SUBSTR(A,1,INSTR(a,' ',1)-1) , SUBSTR(A,INSTR(a,' ',1)+1 , LENGTH(a)) FROM abc
Published by: AJ99 on July 1, 2009 11:09
-
Hello. I recently perchased the new iphone, and I gave my old iphone to my little brother. I erased all the content and the date in the settings menu. This will automatically delete all my photos data old messages etc. thanks
Follow the directions here: what to do before you sell or give away your iPhone, iPad or iPod touch - Apple Support before giving the phone to your brother. -AJ
Maybe you are looking for
-
This just started today. (I believe that yesterday there was an 8.1 automatic Windows Update when I shutdown - don't know if that is related.) Anyway, when I click on a video VIMEO - video VIMEO ALL - everything I get is video (photo), but no sound.
-
Why can't I control the 'name' on my Yahoo email?
I have two Yahoo e-mail accounts. One of them plays very well and as you when I send a message from him, it displays the name I gave you ('Bob W') as the sender when it is received by the recipient. This gives the floor VAC ' t #1. The other account
-
IRQL_NOT_LESS_OR_EQUAL 0x0000000A after installing Windows updates
Blue screen with the following information:IQRL_NOT_LESS_OR_EQUAL STOP: OxOOOOOOOA I get this error for the second time in two months on a Lenovo R61 laptop after installation of the latest version of Windows Update there is very little time. Someti
-
mp3 player Archos is not no detectored at all on windows xp 2009
a archos mp3 player, device dector Player do not recognize it at all, nothing when pluged into usbports, the ports are working properly I checked the pen drivers and they charge ok but nothing to do with it. I have a windows 7 vista 2009 I gotlaptop
-
Problem with the MERGE statement
Hi allWe'll cover the following: create table xx_test1 (invoice_id number, line_group_number number, LINE_TYPE_LOOKUP_CODE VARCHAR2(25) ,LINE_NUMBER NUMBER(15) ); Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TY