Write string array into cfg file
Hi, everybody.
I faced the problem to write array into cfg file. I am trying to put many items in a key. It should look like
[Section1]
Key1=el_1, el_2,el_3,.............el_n.
each element is string of 105 characters. Everything works fine when I save the only one el_1 or multiple for the first time, however, when I am trying to update values in a key section some extra strings appear in a file. My VI is attached.
Thanks in advance
Do you realize that your spreadsheet string only writes the following:
1111111111
2222222222222222
33333333333333333333
The way you wrote your VI, it sends the entire string above to the value for Write Key.vi.
Do you realize that value is for the data type only? So I'm not sure what you want to do....
Without describing the problem you are having, can you describe what you actually want to do?
R
Message Edited by JoeLabView on 07-22-2008 11:49 AM
Attachments:
confused.PNG 26 KB
Similar Messages
-
Read/Write 2d numeric array or string array into bin file
Can anyone pls help me to resolve this problem
Attachments:
bin file.vi 9 KBYou are still using the wrong format.
Whatever you are doing has nothing to do with a binary file.
You are still using way too much duplicate code.
All you probably need is read/write from spreadsheet file, no need to reinvent the wheel.
Your code will fail if the numbers contain decimal digits (since your array is DBL, it could! If your array only contains integers, you are using the wrong numeric representation).
You string code will fail if the array elements contains tabs, for example.
You still don't need a sequence structure.
LabVIEW Champion . Do more with less code and in less time . -
Write the data into a file in 10 ms interval within 10 sec
Hi,
I'm trying to write the data into a file when I press a OK button and the data should write in a file every 10ms interval. After pressing the OK button the process will stop after 10 sec.
I've attached my VI.
Problem is that I'm getting the result every ms. How can I get the data every 10ms? So it'll come 1000 data within 10 sec.
For other calculations purpose I'm using Amplitude and Level Measurements block to get the mean DC voltage, so when I change the Samples to Read and Rates, the process is getting stuck.
Any kind of suggestion is appreciable.
Thanks,
Chotan
Attachments:
DAQ_Time_Checking_For10s_02.vi 131 KBSee example attached, if needed
Nghtcwrlr
********************Kudos are alwayzz Welcome !! ******************
Attachments:
Example.vi 36 KB -
How to convert String array into int.
void getSoldSms(Vector vecSoldSms)
String str[]=new String[vecSoldSms.size()];
String words[]=new String[str.length]; // String array
for(int i=0;i< vecSoldSms.size();i++)
str=(String)vecSoldSms.get(i);
} //End for
for(int i=0;i<str.length;i++)
words = str[i].split("\\|\\|");
System.out.println();
for(int j=0;j<1;j++)
int count[str.length]=Integer.parseInt(words[i]);
System.out.print(count[j]*advance_count);
} // end inner for loop
} //End for
} //End function getSoldSms
how do i convert words which is a string array into int type. i kno string can be converted into int using interger.parseint. but wat abt string arrays??? plz help me out with the above code.i did tht its still giving the same errorFor Heaven's sake, what about taking a second to try to understand the code you're copying first? If you really can't fix the error yourself, you have a more serious problem than just convertingStrings to ints.
And if you want { "1", "2", "3" } to be 123:
StringBuffer b = new StringBuffer();
for (int i = 0; i < array.length; i++) {
b.append(array);
int result = Integer.parseIn(b.toString()); -
Hi Guys!
I need a VI which writes the content of an array into a txt file.
I have an array like this:
Peti Teri
Zoli Hajni
Tomi Heni
Pali Robi
In the file the first line should be a full timestamp (date, time), and then would come the content of the array. The name of the file would also be a timestamp.
Thank you for your help in advance!Hi Victronica and welcome to NI Forums!
If you have some custom data, then it is up to ou to tell excel how to interpret said data (what information to put where, etc.) A simple solution would be to flatten your cluster elements into strings, and write those strings into an excel sheet using ActiveX. An example on how to write a table of strings is available in the example finder, and I also have it attached here in LabVIEW 2013.
Kind regards:
Andrew Valko
National Instruments Hungary
Attachments:
Excel - Write Table.vi 17 KB -
I am wanting to write 2 2D arrays to a file and have them side by side, not one on top of the other. Is there a way to do this? I am basically taking a data set from one test which has several line and columns and then taking similar data and wanting them next to each other so I can sync up the times then do some manipulation of the data as a whole. Any help is appreciated.
One caution is that if your two arrays don't have the same number of rows, the result will be truncated to the shorter of the two. If that's a possibility you'll have to do some padding (with zeros or empty strings).
=====================================================
Fading out. " ... J. Arthur Rank on gong."
Attachments:
Side_by_Side_Unequal_Arrays.vi 40 KB -
Write interger array in a file
I want to write in array of integers in a file. After running the code below, my file contains the wrong character. what can be the problem?
public class Main {
public static void main(String[] arguments) {
byte[] data = { 71, 73, 70};
try {
FileOutputStream file = new FileOutputStream("output.txt");
for (int i = 0; i < data.length; i++)
file.write(data);
} catch (IOException e) {
System.out.println("Error -- " +e.toString());There isn't really a problem, G=71, I=73 and F=70, each byte is a letter.
If you want to write the value rather than the character you could do this:
file.write(Character.getNumericValue((data))); -
String array into formula node
Hello,
I am taking data from SQL, I am getting multiple rows of data for many different devices. I would like to wire the data into a formula node so I can sepearate and sort via script. However, I am getting an error for "Polymorphic terminal cannot accept this data type". Is there a work around? Can I not wire in a string array to a formula node.
/r
TravoThere are lots of basic string VIs that you can use to parse the string and separate out the individual fields. I would recommend "programming" your application using script nodes. Use the native language. LabVIEW is a fully functional and capable programming language.
Mark Yedinak
"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot -
Can I select when do i want to write my data into a file?
What I want is like,
When I click a button as ON then only it goes an writes the data into a spreadsheet.
Now i have made the bolllean so that it will show TRUE when you have to write...but if FALSE nothing should happen...
and I cant see any option in Write to Spread Sheet function for it..
So can you help me out with what should I do
Solved!
Go to Solution.You put the Write to Spreadsheet file in a case structure.
I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours -
Hi, all
I'm looking for the correct method of writing an internal blob value into a file. I know that the best way is using some external language. I.e. Java or C. But also I met a number of solutions of doing within pl/SQL block. All of them look like this:
CREATE OR REPLACE PROCEDURE Write_Binary_file
PC$Directory IN VARCHAR2
,PC$File_Name IN VARCHAR2
,PC$SQL_Order IN VARCHAR2
,PB$Raise IN BOOLEAN DEFAULT FALSE
-- Procedure to dump a BLOB column onto a file
-- parameters:
-- PC$Directory : name of an existing Oracle Directory
-- PC$File_Name : name of the expected output file
-- PC$SQL_Order : SQL order to select the BLOB column
-- PB$Raise : boolean to indicate if the process
-- would be stopped after an error
IS
src_lob BLOB;
buffer RAW(16384);
amt BINARY_INTEGER := 16384;
pos INTEGER := 1;
LF$FicOUT UTL_FILE.FILE_TYPE ;
LC$Msg VARCHAR2(2000) ;
BEGIN
-- get the BLOB column --
BEGIN
EXECUTE IMMEDIATE PC$SQL_Order INTO src_lob ;
EXCEPTION
WHEN NO_DATA_FOUND THEN
LC$Msg := 'Write_Binary_File(): NO_DATA_FOUND' ;
IF PB$Raise THEN
RAISE_APPLICATION_ERROR( -20100, LC$Msg ) ;
END IF ;
Dbms_Output.Put_Line(LC$Msg) ;
RETURN ;
END ;
-- open the output file --
LF$FicOUT := UTL_FILE.FOPEN( PC$Directory, PC$File_Name, 'W', 32764 ) ;
-- write the file --
LOOP
-- read the chunks --
Dbms_Lob.READ (src_lob, amt, pos, buffer);
-- write the chunks --
Utl_File.Put_Raw(LF$FicOut, buffer);
pos := pos + amt;
END LOOP;
-- close the file --
Utl_File.Fclose(LF$FicOut);
EXCEPTION
WHEN NO_DATA_FOUND THEN
utl_file.fclose(LF$FicOut);
WHEN OTHERS THEN
LC$Msg := 'Write_Binary_File() Error : ' || TO_CHAR( SQLCODE ) || ' while managing file ('
|| PC$Directory || ') ' || PC$File_Name ;
IF PB$Raise THEN
RAISE_APPLICATION_ERROR( -20100, LC$Msg ) ;
END IF ;
Dbms_Output.Put_Line(LC$Msg);
END Write_Binary_file;
But this code seems not working. The problem is it always creates a file with a bit bigger size than initial one. So jpg copy will be never be opened with any viewer.
Can anybody explain this issue and give any workaround?
ThanksYou need a code block like this:
DECLARE
l_file UTL_FILE.FILE_TYPE;
l_buffer RAW (32767);
l_amount BINARY_INTEGER := 32767;
l_pos INTEGER := 1;
l_blob BLOB;
l_blob_len INTEGER;
BEGIN
-- Open the destination file. Note the third parameter "wb"
l_file := UTL_FILE.FOPEN ('TEST_DIR', 'extract3.jpg', 'wb');
-- Get LOB locator
FOR rec IN (
SELECT blob_col l_blob
FROM test_my_blob
--AND ROWNUM =1
LOOP
l_blob_len := DBMS_LOB.getlength (rec.l_blob);
-- Read chunks of the BLOB and write them to the file
-- until complete.
WHILE l_pos < l_blob_len
LOOP
DBMS_LOB.READ (rec.l_blob, l_amount, l_pos, l_buffer);
UTL_FILE.put_raw (l_file, l_buffer, FALSE);
l_pos := l_pos + l_amount;
END LOOP;
commit;
END LOOP;
-- Close the file.
UTL_FILE.FCLOSE (l_file);
EXCEPTION
WHEN OTHERS
THEN
-- Close the file if something goes wrong.
IF UTL_FILE.IS_OPEN (l_file)
THEN
UTL_FILE.FCLOSE (l_file);
END IF;
RAISE;
END; -
Hi All ,
I am preparing a Java Swing GUI , In this i have a jTable . Whenever a user writes data into that jTable , the written data should fall in a file .Please tell me the code how to write this jTable data into a file .
Any help will be highly appreciated.
Thanks,
RajeshDon't do that. Why would you want to rewrite the entire file (since you can't really selectively edit it) if just storing (maybe serializing) the table's data model when the application is exiting or an explicit saving is requested by the user would be enough?
-
How to write Strings in a text file with BufferedWriter
I've got a Vector object full of Strings objects, I'm interested in wrinting these Strings in a text file with a BufferedWriter , I would apreciate some code, thank you
http://java.sun.com/products/jdk/1.2/docs/api/java/io/BufferedWriter.html
"PrintWriter out = new PrintWriter(new BufferedWriter((new FileWriter("foo.out")));" -
Huge String Array into smaller different arrays
Hello,
I have an requirement wherein i'll be getting a huge array of Strings (say 10000) elements. This number is variable.
Now i have to break the same into smaller chunks/arrays (say 100 element each).
Thanks,
PiyushHi,
try this.
TYPES :
BEGIN OF type_s_fs,
field(100) TYPE c,
END OF type_s_fs.
DATA fs TYPE type_s_fs.
DATA itab LIKE STANDARD TABLE OF fs.
DATA itab1 LIKE STANDARD TABLE OF fs.
DATA w_d TYPE i.
w_d = STRLEN( w_c ).-----> ( Declare ur longstring here with w_c )
DIVIDE w_d BY 100.
add 1 to w_d.
DATA w_t TYPE i.
DO w_d TIMES.
fs-field = w_c+w_t(100).
APPEND fs TO itab.
CLEAR fs.
ADD 100 TO w_t.
ENDDO.
LOOP AT itab INTO fs.
write :/ fs-field.
ENDLOOP.
With this u can split at 100 characters into single internal table.
Now , loop at this table and assign each record to required internals tables just by reading 1 row.
Or
make use of fieldsymbols. -
How to write multiple inputs into 1 file + how to use PWM
hi,
I wanna take analog inputs from 2 channels, then write them into a single file, have them the data plotted on 1 graph. how can I do that?
also, I wanna output 2 PWM signal lines after some calculations with the data of those 2 channels. how can I do it?
another thing:
can I use Labview to make a state-obersver program?
the board I am using has part number: 183554C-01. it is a DAQ Signal Acessory.hope this helps:
Harold Timmis
[email protected]
Orlando,Fl
*Kudos always welcome
Attachments:
senddatatoonefile.vi 15 KB -
I have 3 of the 1D arrays. When I combine them, I get 1 very long column in excel. Instead I want to have three columns of shorter arrays. I attached the vi. Besides, is there any way I can write on the 1st row of the same excel file.
Attachments:
Ali_PID_Control_Loop_10_formula_frontpanel.vi 132 KBThere's more than one way to "combine" arrays.
Look at the BUILD ARRAY function.
If you wire three arrays to three inputs, you have a choice of outputs:
You can CONCATENATE the inputs, in which case the output is a longer 1-D array.
If you DON'T concatenate them, the output is a 2-D array, which sounds like what you want.
You will probably want to TRANSPOSE the 2-D ARRAY, as this will give you three columns of N rows. Without transposing, you get three rows of N columns.
If the original arrays are not equal length, they will be padded with zeroes.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com
Blog for (mostly LabVIEW) programmers: Tips And Tricks
Maybe you are looking for
-
Artifacts in Illustrator when moving form by pressing the arrow
Please help to define a function to disable these artifacts in Illustrator
-
how do I know total mb b-4 dwnldng ibook to iphone 4
-
Can I use iWeb to create a website with visitor purchasing options?
I'm wondering if it's possible to use iWeb to create and publish a website for a small business like mine where visitors to the site can select items and have the option to make credit card purchases from the site. Obviously all the security for onli
-
Office 365 Best Practices Analyzer requirements
Can you install the office 365 BPA from a windows 7 workstation, or do you need to install it on the Exchange Server itself, and run it from there?
-
Convert video files to editable format to use on PrPro CS4
Hello, I'm using Adobe Premiere Pro CS4 v4.2.1 (I can't use CS5 because I have a 32-bit system). I'm running it on HP Pavilion dv9750, Windows 7, 2.2GHz Intel Core 2 Duo processor T7500, 2GB RAM (DDR2) and NVIDIA GeForce 8400M GS. I'm planning to cre