How to save a 4D Array in a File and load it later on?
Hello,
I am trying to save a 4D Array (Array[4000] [3] [20] [5]) of UINT in a File. I can do it through "write in binary File". But then I can´t load it. I know I can transform my Array down to 1D Array of 1.200.000 Elements (4000*3*20*5) of UINT. When I load it, I have to transform it back (with a lot of "for-looping") back to 4D. But is there an easier way of doing that?
I was not able to find a solution in this forum - I am sorry if I made a new thread if there is already a solution in this forum.
Best regards
LabVIEW 2011
Solved!
Go to Solution.
As Lynn said, there should be no extra code required.
When writing, make sure that "prepend size" is true (true is default) and when reading, wire an empty 4D array of the correct representation to the "data type" input.
(I also assume that your LabVIEW version is not extremely ancient)
LabVIEW Champion . Do more with less code and in less time .
Similar Messages
-
How to extract a single colum form XML files and load in a table
Hi below I have a structure of xml files , I just need to extarct <RecordReference>PQPMID:7358</RecordReference>
from file and load in to oracle ..
Please let me know how to do ..??
file content below
HoldingsRecord>
<RecordReference>PQPMID:7358</RecordReference>
<NotificationType>00</NotificationType>
<SerialVersion>
<SerialVersionIdentifier>
<SerialVersionIDType>07</SerialVersionIDType>
<IDValue>1068624X</IDValue>
</SerialVersionIdentifier>
<SerialVersionIdentifier>
<SerialVersionIDType>01</SerialVersionIDType>
<IDTypeName>PMID</IDTypeName>
<IDValue>7358</IDValue>
</SerialVersionIdentifier>
<Title>
<TitleType>02</TitleType>
<TitleText>Pittsburgh Post - Gazette</TitleText>
</Title>
<Publisher>
<PublishingRole>01</PublishingRole>
<PublisherName>Post Gazette Publishing Company</PublisherName>
</Publisher>
<OnlinePackage>
<OnlineServiceName>ProQuest</OnlineServiceName>
<Website>
<WebsiteRole>03</WebsiteRole>
<WebsiteLink>http://proquest.umi.com/pqdweb</WebsiteLink>
</Website>
<HoldingsDetail>
<JournalIssue>
<JournalIssueRole>04</JournalIssueRole>
<JournalIssueDate>
<DateFormat>00</DateFormat>
<Date>19930118</Date>
</JournalIssueDate>
</JournalIssue>
<JournalIssue>
<JournalIssueRole>06</JournalIssueRole>
<JournalIssueDate>
<DateFormat>00</DateFormat>
<Date>20080915</Date>
</JournalIssueDate>
</JournalIssue>
<EpubFormat>10</EpubFormat>
</HoldingsDetail>
</OnlinePackage>
</SerialVersion>
</HoldingsRecord>DECLARE
l_clob CLOB;
l_bfile BFILE;
l_parser dbms_xmlparser.Parser;
l_doc dbms_xmldom.DOMDocument;
l_nl dbms_xmldom.DOMNodeList;
l_n dbms_xmldom.DOMNode;
l_temp VARCHAR2(1000);
src_csid NUMBER := NLS_CHARSET_ID('UTF8');
dest_offset INTEGER := 1;
src_offset INTEGER := 1;
lang_context INTEGER := dbms_lob.default_lang_ctx;
warning INTEGER;
TYPE tab_type IS TABLE OF gt_pq_pmid%ROWTYPE;
t_tab tab_type := tab_type();
BEGIN
l_bfile := BFileName('XML_DIR', 'SOH_sample.xml');
dbms_lob.createtemporary(l_clob, cache=>FALSE);
dbms_lob.open(l_bfile, dbms_lob.lob_readonly);
dbms_lob.loadclobfromFile( l_clob,
l_bfile,
dbms_lob.getLength(l_bfile),
dest_offset,
src_offset,
src_csid,
lang_context,
warning);
dbms_lob.close(l_bfile);
dbms_session.set_nls('NLS_DATE_FORMAT','''DD-MON-YYYY''');
l_parser := dbms_xmlparser.newParser;
dbms_xmlparser.parseClob(l_parser, l_clob);
l_doc := dbms_xmlparser.getDocument(l_parser);
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
-- Get a list of all the row nodes in the document using the XPATH syntax.
l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'HoldingsRecord/');
FOR cur_stage_xml IN 0 .. dbms_xmldom.getLength(l_nl) - 1 LOOP
l_n := dbms_xmldom.item(l_nl, cur_stage_xml);
t_tab.extend;
dbms_xslprocessor.valueOf(l_n,'RecordReference/text()',t_tab(t_tab.last).pq_pmid);
END LOOP;
FOR cur_stage_xml IN t_tab.first .. t_tab.last LOOP
INSERT INTO
gt_pq_pmid (
pq_pmid )
VALUES
(t_tab(cur_stage_xml).pq_pmid);
END LOOP;
COMMIT;
dbms_xmldom.freeDocument(l_doc);
EXCEPTION
WHEN OTHERS THEN
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
dbms_xmldom.freeDocument(l_doc);
raise ;
END;---------- and i am getting below error
ERROR at line 1:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00210: expected '<' instead of 'H'
Error at line 1
ORA-06512: at line 65 -
How to save the time to a .txt file and retrive it back as time?
I have to save the time [hour:minute:second] and the date [date:month:year] to a .txt file. I am using the Calendar API to set the time and date as below
FileOutputStream fileStream = new FileOutputStream ("what.txt");
PrintWriter pw=new PrintWriter(fileStream, true);
Calendar curDate = Calendar.getInstance();
System.out.print(curDate.get(Calendar.DATE)+":");
System.out.print(months[curDate.get(Calendar.MONTH)]+":");
System.out.print(curDate.get(Calendar.YEAR));
pw.println(curDate);
I'll have to retrive these data back to use it to set timer
timer = new Timer();
timer.schedule(new RemindTask(), time);
I try to retrive the data and use the Calendar API to that data by using the below program.
I get the error as :
C:\t\Retrivedate.java:41: int cannot be dereferenced
System.out.print(t.get(Calendar.DATE)+":");
How can I solve this so that I can use Calendar API on my retrived data?
import java.io.*;
import java.util.*;
import java.lang.*;
class Test {
public static void main(String args[]) {
try {
File inputFile = new File("what.txt");
FileReader in = new FileReader("what.txt");
int t;
char[] tmp = new char[100];
int cnt = in.read(tmp);
String tm="";
for (int j=0;j<cnt;j++)
{ tm+=tmp[j];
try {
t=Integer.parseInt(tm,10);
catch (NumberFormatException exception) {}
System.out.println("jika "+tm);
Calendar curDate = Calendar.getInstance();
String months[]={
"Jan","Feb","Mar","Apr",
"May","June","July","Aug",
"Sept","Oct","Nov","Dec"};
Date time1 = curDate.getTime();
System.out.print(" \n"+time1.getHours());
System.out.print(":"+time1.getMinutes());
System.out.println(":"+time1.getSeconds());
System.out.print(t.get(Calendar.DATE)+":");
System.out.print(months[t.get(Calendar.MONTH)]+":");
System.out.print(t.get(Calendar.YEAR));
in.close(); }
catch (IOException ex) {
System.out.println("IOException:"+ex.toString()); }These lines do not make sense:
System.out.print(t.get(Calendar.DATE)+":");
System.out.print(months[t.get(Calendar.MONTH)]+":");
System.out.print(t.get(Calendar.YEAR));
1. t is an integer, it does not have any methods.
2. It's a bad idea to use char[] to retrive the date. You should use readLine() method to retrieve the whole date string, say "10/23/2001" (certainly you can have hours, minutes, seconds, etc.). Then you need to use SimpleDateFormat class to parse this string. SimpleDateFormat gives you everything to parse a date string in any format you want.
PC -
How to save report output in a PDF file and also show preview in one processing cycle
Hi every body,
We R re-developing an application from COBOL to Oracle.
Using Reports 6i 6.0.8.11.3.
The requirement is that whenever a user processes a report, it should be saved on disk say in PDF format. Then it should be shown in Reports Runtime Previewer.
So far I have explored that only one of theses can be done in one processing cycle.
That is if we set DESTYPE to FILe it will only be saved to disk. If we set DESTYPE to Preview, the report can be previewed and optionally printed but not saved.
I want that both saving to disk and preview should be possible.
I have explored .DST file option but there is only provision for FILE, PRINTER and MAIL.
Printing facility should be optional, otherwise we would have used FILE and PRINTER destinations in .DST file.
Once that file is saved on disk, it can later on be printer if user requires more copies.
I would prefer a solution other than User_exit as I don't have training in developing user_exits.
Any help please.
TariqI had a similar requirement and decided to run the report from forms. When a button is pressed, the report is run to create the pdf file, followed by separate command to invoke acrobat reader or internet explorer to display the file, rather than using reports previewer.
The file can be displayed from forms by a host command in client server, or by web.show_document on the web. -
How do you make an array of image icons and then call them?
How do you make an array of image icons and then call them, i have searched all over the internet for making an array of icons, but i have
found nothing. Below is my attempt at making an array of icons, but i cant seem to make it work. Basically, i want the image to match the value of the roll of the dice (rollVal)
Any help would be greatly appreciated, some code or link to tuturial, ect.
/** DiceRoller.java
* Roll, print, Gui
import javax.swing.*;
public class DiceRoller extends JFrame
private ImageIcon[] image ;
public String[] images = { "empty", "dice1.jpg",
"dice2.jpg", "dice3.jpg", "dice4.jpg",
"dice5.jpg", "dice6.jpg" };
public Dice die;
private int rollVal;
public int rollNum;
private JLabel j1;
public DiceRoller(){
j1= new JLabel("");
die =new Dice();
int rollVal;
rollVal = die.roll();
image = new ImageIcon[images.length];
for(int i = 0; i < images.length; i++){
image[i] = new ImageIcon(images);
if (image!=null){
j1.setIcon(image[rollVal]);
System.out.println("Roll = "+die.roll());Demo:
import java.awt.*;
import java.net.*;
import javax.swing.*;
public class IconExample {
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable(){
public void run() {
launch();
static void launch() {
try {
Icon[] icons = new Icon[6];
for(int i=0; i<icons.length; ++i) {
String url = "http://www.eureka-puzzle.be/cast/images/dice" + (i + 1) + ".jpg";
icons[i] = new ImageIcon(new URL(url));
display(icons);
} catch (MalformedURLException e) {
throw new RuntimeException(e);
static void display(Icon[] icons) {
JPanel cp = new JPanel();
for(Icon icon : icons) {
cp.add(new JLabel(icon));
JFrame f = new JFrame();
f.setContentPane(cp);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
} -
How to save the audio bytes in a file
I am capturing the audio from microphone.I write the audio data as bytes to other clients.How can i save the bytes in a wav file and it can be played in future?Please help.I want to write the audio bytes in a wav file
get sample source code from
http://javasolution.blogspot.com/2007/04/record-and-save-audio-using-java.html -
How to save settings in the front panel to different files and retrieve it later?
How to save the front-panel controllers' settings to different files and retrieve it later?
What I've archived is the "Save Settings" function, but when trying to "Reload Settings", I can only retrieve the saved data to front-panel indicators, but not the controllers!
Can anybody give me some advises?
Thanks in advanced!
Charles LuHi
Just write the retrieved data to a local variable (but make it writable first) or property node of the controls.
Hope this helps.
Thomas
Using LV8.0
Don't be afraid to rate a good answer... -
How to save Internal table as a local file?
Hi,
How to save Interanl table as a local file ?
I had some data which i had selected in Interanl table and would like to send this as an attachment by attaching internal table contents as a local file--Hi friend,
See sample code for GUI_DOWNLOAD.
*Types
TYPES: BEGIN OF g_r_mara,
matnr LIKE mara-matnr,
ersda LIKE mara-ersda,
laeda LIKE mara-laeda,
mtart LIKE mara-mtart,
mbrsh LIKE mara-mbrsh,
END OF g_r_mara.
*Data
DATA: g_t_mara TYPE TABLE OF g_r_mara,
filename TYPE string.
*Tables
TABLES: mara, sscrfields.
*Selection Screen
SELECT-OPTIONS: s_matnr FOR mara-matnr.
SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT 10(20) text-001 FOR FIELD p1.
SELECTION-SCREEN PUSHBUTTON 12(20) word USER-COMMAND uc.
SELECTION-SCREEN END OF LINE.
*Initilizing data.
INITIALIZATION.
word = 'word'.
filename = 'C:\Testing.doc'. <------- File name and location
AT SELECTION-SCREEN.
CASE sscrfields-ucomm.
WHEN 'UC'.
*Data retrival
SELECT matnr ersda laeda mtart mbrsh
INTO CORRESPONDING FIELDS OF TABLE g_t_mara
FROM mara
WHERE matnr IN s_matnr.
*Downloading data from internal table to excel
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = filename
filetype = 'ASC'
write_field_separator = 'X'
TABLES
data_tab = g_t_mara.
ENDCASE.
(Note: Downloaded file is in C:\Testing.doc)
You can change the file format by changing the extension in filename.
Might helpful for u.
Thanks.. -
Linux server(how to save command out put to another file. )
hi all,
i have Q ?
how to save command out put to another file.
Ex: #ps -ef
that particular cmd output i need to save another file.
is it possible ...if possible ..please let me know
And how to save command history in Linux.df -h >> /oracle/output.log
/oracle -- mount point name
Regards
Asif Kabir -
ANYBODY KNOW how to save a swatch in an ID file at a percentage?
ANYBODY KNOW how to save a swatch in an ID file at a percentage?
So that every time it's used, it applies that percentage automatically?LOL...nevermind. Took me 2 seconds to realize all I needed to do after posting this. Sad trombone.
-
How do I scan a photo to a file and then send the file as an attachment via email.
How do I scan a photo to a file and then send the file as an attachment via email.
All of this depends largely on what printer /software you have, which Email client you use and to some extent which OS you are running.
Most HP printers have HP Solution Center which is used to set up scanning,choosing where to save,etc. Once a file/photo is scanned and saved to the folder, open the folder.Select the file and at the top of the window should be the option to 'Email'.
******Clicking the Thumbs-Up button is a way to say -Thanks!.******
**Click Accept as Solution on a Reply that solves your issue to help others** -
How to search a special string in txt file and return it's position in txt file?
How to search a special string in txt file and return it's position in txt file?
I just posted a solution for a similar question here: http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=362699#M362699
The top portion can search for the location of a string, while the bottom portion is to locate the position of a character. Both can search for a character.
The position of the character within the file is displayed in the indicator(s).
R -
How can i open a DOC or TXT file and insert the data into table?
How can i open a DOC or TXT file and insert the data into table?
I have a doc file . the doc include some columns and some rows.(for example 'ID,Name,Date,...').
I'd like open DOC file and I'd like insert them into the table with same columns.
Thanks.Use the SQL*Loader utility or the UTL_FILE package.
-
How can I extract part of a PDF file and copy it to a new PDF file?
How can I extract part of a PDF file and copy it to another PDF file?
You will need Adobe Acrobat for this.
-
How to make blank copies of a PDF file and put it into the printer tray.
Dear experts,
Before you try printing the data from the FM, How tomake several blank copies of the PDF file and put it in the printer tray so that you can print just the data from the function module on it??????
Please reply.Hi drredwood,
When you open your PDF file a yellow bar will appear on the top of the screen.
Click on 'Enable All Features'.
Then you will be able to copy the content from your pdf and to paste in any of the file.
Regards,
Florence
Maybe you are looking for
-
Different expression depending on dimension dragged
Hi, I need to have a different column physical mapping expression, depending on which dimension the user retrieves. Example: I want the Fact logical column "Fact.DOLLARS" map to the physical column: 1. SUM(CASE WHEN Dim1.ColumnA = Dim1.ColumnB then d
-
RTX Dual Phone and Online Number
I'm planning on getting RTX Dual Phone with an online number to replace my land line. The requirements specify Broadband Internet connection (I have DSL service and a router with open ports). The requirements also state 'landline operator subscriptio
-
Migration for only some selected programmes.
Today I bought a new MacBook Pro 13" Retina. No I like to copy Photoshop CS6 and some NIK porgrammes from my 2010 iMac to the new MakBook. 1. Is it possible to migrate only one or selected programmes from one mac to the other? And if not, what will b
-
Why can I not share my whole library from an old PC to a new one? Is it because the old library is on the cloud?
-
Transaction posted to subledger account does not show as open
Hi Experts, After configuring the basic settings, I posted an expense based vendor invoice using T.Code FB60. When I checked this entry in Vendor line item(FBL1N), it does not show as open, but cleared. At line item level clearing details show as fol