How to save data (DBL array) in a excel file
Ok, I am new into Labview. This question may seem easy for you guys, but for me, it is quite a challenge. I have current coming out of a loop. When the program stop, I would like to be able to save it as well as the time when it has been taking and the average current in a excel file. When my labview code stops, how do I do to get a pop up window which ask me where and what name to save it to? How do I get so that on the top of each column, it says : current (Amp) Time (ms) Average Current (amp)?
thank you very much,
Hello,
We love to see people catch the LabVIEW spirit and anything we can do to help
you through the initial learning process is our pleasure.
As KC suggested saving the file as a .csv is a good idea,
you can also save it as a txt file and open it with Excel specifying a delimiter
for the columns.
There is a really good example you can find in the LabVIEW
example finder if you search for the keyword ‘file’, the example is called “Write
to Text File.vi”. They use a Get date/time String to record the time when data
is acquired.
I have attached a simple Write to File picture of a VI that
takes a random number and writes it to a file. When I run the VI, a popup asks
me what I want to call the file. The first part writes the heathers on the
columns and inside of the for loop I save the data. Underneath the block diagram
is a picture of the output file when I specify the number of samples to be five.
If you want your file to be on a very specific format, you
can create a template file, read it in LabVIEW, and then add your data to it
and save it to a new file.
Hope this can get you started with your program.
There are a lot of good tutorials online on how to
get started using LabVIEW. Here is the link to a three hour
introduction course:
http://zone.ni.com/devzone/learningcenter.nsf/03f7c60f17aad210862567a90054a26c/60c2782788a811c986256cd50001a0a6?OpenDocument&node=200067_us
We are also comming out with LabVIEW 8 in November and we have a program called LabVIEW Standard Service Program
(SSP) that allows you to get automatic upgrades and updates. Please let
me know if you are interested in knowing more about it.
Good luck,
Tica Taveras
Applications Engineer
National Instruments
Attachments:
SaveData.bmp 1475 KB
Similar Messages
-
How to retrieve data from a read-only Excel file
Hi Developers,
I'm trying to retrieve data from a read-only Excel file. I used the same code that I used to retrieve data from a normal Excel file, but it can't work.
My code is as followed:
try
InputStream KpExcel = new FileInputStream("kp.xls");
HSSFWorkbook Kpwb = new HSSFWorkbook(KpExcel);
HSSFSheet Kpsheet = Kpwb.getSheetAt(0);
catch(Exception e)
e.printStackTrace();
System.out.println("Exception: "+e.getMessage());
The error I received is as followed:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:224)
at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:160)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:163)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:210)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:191)
at photoproductionsystem.IncomingWIPPanel.getKp(IncomingWIPPanel.java:118)
at photoproductionsystem.IncomingWIPPanel.<init>(IncomingWIPPanel.java:76)
at photoproductionsystem.TabbedDisplay.<init>(TabbedDisplay.java:47)
at photoproductionsystem.Display.create(Display.java:73)
at photoproductionsystem.Display.init(Display.java:44)
at photoproductionsystem.Display.main(Display.java:229)
Caused by: java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at org.apache.poi.hssf.record.UnknownRecord.<init>(UnknownRecord.java:62)
at org.apache.poi.hssf.record.SubRecord.createSubRecord(SubRecord.java:57)
at org.apache.poi.hssf.record.ObjRecord.fillFields(ObjRecord.java:99)
at org.apache.poi.hssf.record.Record.fillFields(Record.java:90)
at org.apache.poi.hssf.record.Record.<init>(Record.java:55)
at org.apache.poi.hssf.record.ObjRecord.<init>(ObjRecord.java:61)
... 15 more
Can someone please help me with my problem? Thanks a lot in advance!Madeline wrote:
how do I ask at Apache mailing list?I wonder why it seems to be a strange idea to some people to look at the software vendor's site for product support. :p
http://poi.apache.org/mailinglists.html -
How to determine data type of cell in Excel file
I have a company standard Excel file that needs to be read to determine what tests to run. I have no control over its format. I need to be able to tell what the data type is in order to read it using the LabView sample code. It is a hodge poge of numbers and strings. Some of the numeric fields are formated as hex while some are floating point. There does not appear to be a vi that I can call to determine info about the cell formating. As I remember it, the Windows Active X control for accessing Excel support that. I really was hoping to avoid dealing with the Active X control for Excel directly.
Any help/ideas?
Outputting it in CSV or similar is not an option.
Solved!
Go to Solution.If you have to deal with Excel directly, I don't see how you're going to get around using Active X.
MSDN page on using ActiveX -
How to Downlaod Data from Alv List to Excel File
Hi,
I have a Requirement like While download data from ALV to Excel File .After Download data into Excel we will not allow user to edit the Excel data..
Plz help me to complete this scenario.
Thanks & Regards,
Kumaran Duraiswamy.hi,
try these following fm's
MS_EXCEL_OLE_STANDARD_DAT
EXCEL_OLE_STANDARD_DAT
CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
EXPORTING
file_name = 'Your Path' " enter your path to save the file.
CREATE_PIVOT = 0
* DATA_SHEET_NAME = ' '
* PIVOT_SHEET_NAME = ' '
* PASSWORD = ' '
* PASSWORD_OPTION = 0
VISIBLE = '0'
No_DIALOG = 'X'
TABLES
* PIVOT_FIELD_TAB =
DATA_TAB = t_deli_final
* FIELDNAMES =
EXCEPTIONS
FILE_NOT_EXIST = 1
FILENAME_EXPECTED = 2
COMMUNICATION_ERROR = 3
OLE_OBJECT_METHOD_ERROR = 4
OLE_OBJECT_PROPERTY_ERROR = 5
INVALID_FILENAME = 6
INVALID_PIVOT_FIELDS = 7
DOWNLOAD_PROBLEM = 8
OTHERS = 9
IF sy-subrc 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
2nd fm
CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
EXPORTING
FILE_NAME = 'Your Path' "path to save your file
DATA_SHEET_NAME = V_SHEET_NAME
TABLES
DATA_TAB = TLX
EXCEPTIONS
FILE_NOT_EXIST = 1
FILENAME_EXPECTED = 2
COMMUNICATION_ERROR = 3
OLE_OBJECT_METHOD_ERROR = 4
OLE_OBJECT_PROPERTY_ERROR = 5
INVALID_FILENAME = 6
INVALID_PIVOT_FIELDS = 7
DOWNLOAD_PROBLEM = 8
OTHERS = 9.
IF SY-SUBRC NE 0.
WRITE:/ 'ERROR OPENING EXCEL'.
ENDIF.
ELSE.
WRITE:/ 'ERROR OR NO DATA'.
ENDIF. -
How to read data in correct format from EXCEL file into an internal table??
Hi Experts,
My requirement is to upload data from an excel file on presentation server into an internal table on <b>SRM</b> server.
I used 'GUI_UPLOAD' function module to achieve the same but all the the data is getting uploaded in # only.I had set in the 'HAS_FIELD_SEPARATOR' to 'X' to overcome this problem.
But all the efforts are in vain. The function module 'ALSM_EXCEL_TO_INTERNAL_TABLE' doesn't exist on SRM Server and I am not getting any other function module having similar functionality available on SRM server.
I have written the following code:-
TYPES: BEGIN OF ty_addr_loc,
userid TYPE xubname, "User Id
addr_code TYPE char4, "3 Digit Site Location Code/4 Digit
"Alternate Address
loc_id TYPE bbp_location, "Indicator: Address is standard address
END OF ty_addr_loc.
*Retrieving file name
parameters: p_file type rlgrap-filename.
DATA:
Local variable holding file name
l_file TYPE string,
Local Variable holding the file type,
l_type TYPE filetype VALUE 'ASC',
Local Variable holding the field separator
l_sep TYPE char01,
i_tab type standard table of ty_addr_loc.
Clearing local variables
CLEAR:
l_file,
l_sep.
Initializing the local variables
MOVE p_file TO l_file.
l_sep = 'X'.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_file
filetype = l_type
has_field_separator = l_sep
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = i_tab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17
IF sy-subrc <> 0.
Throwing an information message
MESSAGE i003. "Data Upload Failed
LEAVE LIST-PROCESSING.
ENDIF.
Please tell me a way out. I have to make a delivery urgently.
Thanks in advance,
Swati GuptaHi
Try the FM <b>KCD_EXCEL_OLE_TO_INT_CONVERT</b>
Sample:
call function 'KCD_EXCEL_OLE_TO_INT_CONVERT'
exporting
filename = i_filename
i_begin_col = l_begin_col
i_begin_row = l_begin_row
i_end_col = l_end_col
i_end_row = l_end_row
tables
intern = xt_intern
exceptions
INCONSISTENT_PARAMETERS = 201
UPLOAD_OLE = 201.
if sy-subrc <> 0.
e_subrc = sy-subrc.
exit.
endif.
<b>reward if Helpful.</b> -
How to change data in decision table using excel file in operating system?
Hello, BRF Experts
I now brf + for the first time in the current project is being developed.
Now, project has been facing a big problem.
Develop system that was developed in the history of decision table in the operating system can be used to update excel file, etc. I do not know whether.
So, I was tested, but can not change data in decision table.
[ error message : system is not change allowed ].
The operating system itself to the current system setting is immutable and check it
: changes and transports for client-specific object -> no changed allowed
: cross-client object changes -> no changes to repository and cross-client customizing object.
Decision table in the operating system can update the details if I want to know what to do.
Maintenance view can be modified in the operating system as a decision table, I wonder if you can create a view.
Edited by: Sung-Wook Ha on Jan 13, 2012 2:02 PMHi ,
Exchanging data with Microsoft Excel is done with the help of the XML-based file format (file extension .XSLX) introduced with Microsoft Excel 2007. If you are using an older version of Microsoft Office, you can download the Microsoft Office Compatibility Pack to upgrade the supported file formats from the Microsoft Download Center ([Exchanging Decision Table Data With Microsoft Excel |http://www.microsoft.com/downloads/details.aspx?familyid=941b3470-3ae9-4aee-8f43-c6bb74cd1466]). Once you have downloaded the Compatibility Pack, you have to install it on every workstation that has an older version of Microsoft Office installed.
Please refer the link-
[BRFplus-Data exchange with MS Office 2007|http://help.sap.com/erp2005_ehp_05/helpdata/en/b8/e03486d1df48c6baa3c4354f5198ee/frameset.htm]
Hope this helps.
Thanks,
Ajay -
How to download data from different sheet of excel file.
Hi Friends,
I have a Excel file with different sheet like sheet 1, sheet 2 and so on,
and i have to download each sheet data in to different internal tables.
Is there any FM or something else.
Pl. help
Thanks
Sunil.Hi,
You can create the function module for this.
The code sample is as below:
*Code Sample *
FUNCTION Z_UPLOADING_FROM_2SHEETS.
""Local interface:
*" IMPORTING
*" VALUE(FILE_NAME) LIKE RLGRAP-FILENAME
*" VALUE(START_ROW_SHEET1) TYPE I
*" VALUE(START_COLUMN_SHEET1) TYPE I
*" VALUE(START_ROW_SHEET2) TYPE I
*" VALUE(START_COLUMN_SHEET2) TYPE I
*" VALUE(END_ROW_SHEET1) TYPE I
*" VALUE(END_COLUMN_SHEET1) TYPE I
*" VALUE(END_ROW_SHEET2) TYPE I
*" VALUE(END_COLUMN_SHEET2) TYPE I
*" TABLES
*" IT_DATA1 STRUCTURE ALSMEX_TABLINE
*" IT_DATA2 STRUCTURE ALSMEX_TABLINE
*" EXCEPTIONS
*" INCONSISTENT_PARAMETERS
*" UPLOAD_OLE
DATA DECLARATION
DATA: excel_tab TYPE ty_t_sender,
excel_tab1 TYPE ty_t_sender.
DATA: ld_separator TYPE c.
DATA: application TYPE ole2_object,
workbook TYPE ole2_object,
SHEET TYPE OLE2_OBJECT,
range TYPE ole2_object,
worksheet TYPE ole2_object.
DATA: h_cell TYPE ole2_object,
h_cell1 TYPE ole2_object.
DATA: ld_rc TYPE i.
MESSAGE DEFINATION
DEFINE m_message.
case sy-subrc.
when 0.
when 1.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
when others. raise upload_ole.
endcase.
END-OF-DEFINITION.
PARAMETER CHECK
IF START_ROW_SHEET1 > END_ROW_SHEET1.
RAISE inconsistent_parameters.
ENDIF.
IF START_COLUMN_SHEET1 > END_COLUMN_SHEET1.
RAISE inconsistent_parameters.
ENDIF.
IF START_ROW_SHEET2 > END_ROW_SHEET2.
RAISE inconsistent_parameters.
ENDIF.
IF START_COLUMN_SHEET2 > END_COLUMN_SHEET2.
RAISE inconsistent_parameters.
ENDIF.
CLASS cl_abap_char_utilities DEFINITION LOAD.
ld_separator = cl_abap_char_utilities=>horizontal_tab.
OPENING EXCEL FILE
IF application-header = space OR application-handle = -1.
CREATE OBJECT application 'Excel.Application'.
m_message.
ENDIF.
CALL METHOD OF APPLICATION 'Workbooks' = WORKBOOK.
m_message.
CALL METHOD OF application 'Workbooks' = workbook.
m_message.
CALL METHOD OF workbook 'Open' EXPORTING #1 = FILE_NAME.
m_message.
CALL METHOD OF APPLICATION 'Worksheets' = SHEET EXPORTING #1 = 1.
m_message.
CALL METHOD OF APPLICATION 'Worksheets' = SHEET EXPORTING #1 = 1.
m_message.
CALL METHOD OF SHEET 'Activate'.
m_message.
GET PROPERTY OF application 'ACTIVESHEET' = sheet.
m_message.
MARKING OF WHOLE SPREADSHEET
CALL METHOD OF sheet 'Cells' = h_cell
EXPORTING #1 = START_ROW_SHEET1 #2 = START_COLUMN_SHEET1.
m_message.
CALL METHOD OF sheet 'Cells' = h_cell1
EXPORTING #1 = END_ROW_SHEET1 #2 = END_COLUMN_SHEET1.
m_message.
CALL METHOD OF sheet 'RANGE' = range
EXPORTING #1 = h_cell #2 = h_cell1.
m_message.
CALL METHOD OF range 'SELECT'.
m_message.
Copy marked area (SHEET1) into Clippboard
CALL METHOD OF range 'COPY'.
m_message.
Read clipboard into ABAP
CALL METHOD cl_gui_frontend_services=>clipboard_import
IMPORTING
data = excel_tab
EXCEPTIONS
cntl_error = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE a037(alsmex).
ENDIF.
PERFORM separated_to_intern_convert TABLES excel_tab IT_DATA1
USING ld_separator.
Clear the clipboard
REFRESH excel_tab.
CALL METHOD cl_gui_frontend_services=>clipboard_export
IMPORTING
data = excel_tab
CHANGING
rc = ld_rc
EXCEPTIONS
cntl_error = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4
Working in Second Excel Work Sheet
CALL METHOD OF APPLICATION 'Worksheets' = SHEET EXPORTING #1 = 2.
m_message.
CALL METHOD OF SHEET 'Activate'.
m_message.
GET PROPERTY OF application 'ACTIVESHEET' = sheet.
m_message.
Mark Sheet2
CALL METHOD OF sheet 'Cells' = h_cell
EXPORTING #1 = START_ROW_SHEET2 #2 = START_COLUMN_SHEET2.
m_message.
CALL METHOD OF sheet 'Cells' = h_cell1
EXPORTING #1 = END_ROW_SHEET2 #2 = END_COLUMN_SHEET2.
m_message.
CALL METHOD OF sheet 'RANGE' = range
EXPORTING #1 = h_cell #2 = h_cell1.
m_message.
CALL METHOD OF range 'SELECT'.
m_message.
Copy Marked Area (Sheet2) into Clippboard
CALL METHOD OF range 'COPY'.
m_message.
Read Clipboard into ABAP
CALL METHOD cl_gui_frontend_services=>clipboard_import
IMPORTING
data = excel_tab1
EXCEPTIONS
cntl_error = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE a037(alsmex).
ENDIF.
PERFORM separated_to_intern_convert TABLES excel_tab1 IT_DATA2
USING ld_separator.
Clear Clipboard
REFRESH excel_tab.
CALL METHOD cl_gui_frontend_services=>clipboard_export
IMPORTING
data = excel_tab1
CHANGING
rc = ld_rc
EXCEPTIONS
cntl_error = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4
Leaving Application .
CALL METHOD OF application 'QUIT'.
m_message.
FREE OBJECT application.
m_message.
ENDFUNCTION. -
Need help with how to store data in array in from reading file
i have a file named xxx.txt
i need to retreive data from that file. the data that i want to retrieve is enclosed with << >>
temp xxx-123 ccc << 90.5>>
haha xxx-563 sss 85.2
after a few lines, the another record appear.
temp2 xxx-123 ccc << 190.5>>
haha2 xxx-563 sss 885.2
i would like to record down the data, 90.5 & 190.5, how do i go about doing so, will appreciated it if someone would guide me along. thanksAfter you have read a line from the file either
find the location of << and >> and substring the stuff in between or
use regex (regular expression) however this is advanced and may be beyond your level of understanding. -
How to save data in ztable after editing in alv report
how to save data in ztable after editing in alv report?
Hi,
Please find the attachment below.This may be usefull to you.
[http://wiki.sdn.sap.com/wiki/display/Snippets/ALV-Editingandsavingtheeditedvaluesin+Database%28OOPS%29]
Regards,
Ramakrishna Yella. -
Could u plz help me to find simple example for how to save data file in a spread sheet or any other way in the real time controller for Sbrio 9642 using memory or usb flash memory
Here are a few Links to a helpful Knowledge Base article and a White Paper that should help you out: http://digital.ni.com/public.nsf/allkb/BBCAD1AB08F1B6BB8625741F0082C2AF and http://www.ni.com/white-paper/10435/en/ . The methods for File IO in Real Time are the same for all of the Real Time Targets. The White Paper has best practices for the File IO and goes over how to do it.
Alex D
Applications Engineer
National Instruments -
How to save data model design in pdf or any format..?
how to save data model design in pdf or any format..?
i ve created design but not able to save it any mage or pdf formatFile -> Print Diagram -> To PDF File
-
Save data to array(dele​te two previous wrong threads, please )
Sorry ,I have put two same threads in this board by wrong operation, please delete for me.Thanks.
Hi, I want to save a series of data to an array in the
following prosedure: The first data come (index of array
= 0), save the data to a(0), then the second data come,
array index +1, save the data to a(1),...... I have write a
vi, but it doesn't work
Attachments:
save data to array.vi 11 KBtrinigh,
I'm not sure I get your point and only have LabVIEW 7.1, so could you just post an image of your diagram.
If what you want is to build (not save) an array, you should use the "build array" function in a loop, like this...
When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"
Attachments:
Untitled12.vi 37 KB -
帖子被trinight在02-19-2006 07:14 AM时编辑过了
Attachments:
save data to array.vi 11 KBHi, K C. In another post I got some examples. In my case , I have a data source which outputs two numbers at a time(like 8.2 9.6), then after a fixed time interval, it outputs another two numbers...... I want to keep these numbers in a two demention array. I attach a example(add to array.JPG) from someone(in another post you can find the details) which has a fault , that is if two same number come along, it can only save one to the array. I attach another image of vi which I made myself(add to array[1].JPG), which has a fault too, I didn't know why, wish you can help me. Tomorrow I will go out for several days. So I cann't reply in the following days.
Attachments:
add to array.JPG 34 KB
add to array[1].JPG 62 KB -
How to download data from abap-ouput to excel sheet with logo
how to download data from abap-ouput to excel sheet with standard logo
Edited by: Harish Kasyap on Nov 18, 2008 8:19 AM
Edited by: Harish Kasyap on Nov 18, 2008 8:20 AMFor saving the report you can goto System -> List -> Save -> Local File -> Location where you want to save in your presentation server.
You can also give a option in your selection screen to save the file to Presentation server using FM GUI_DOWNLOAD.
Hope it helps.
Thanks,
Jayant. -
Hi am trying to save Data into a write to measurement file vi using a NI PXI 1042Q and DAQ NI PXI-6229 with a real time mode but it is not working but when i run it without uploading it into the PXI it save in to the file please find attached my vi
Attachments:
PWMs.vi 130 KBother problem is that the channel DAQmx only works at real time mode not on stand alone vi using Labview 8.2 and Real time 8.2
Maybe you are looking for
-
I make changes to photos, then use the "share" command to put on a CD - and the photos on the CD do not have any of my changes/edits. Same thing happens when I email the photo. I turned it to black and white in iPhoto, but the picture in the email
-
Iphone 4 purchased on line in Hong Kong
I understood it's un-locked phone if the purchase was done to Apple on-line. I brought it for the use in Bangkok Thailand and can't activated the phone. Do I miss anything that prevent me from activating the phone?
-
Camera Raw 6.2 Release Candidate Now Available on Adobe Labs
http://blogs.adobe.com/lightroomjournal/2010/08/lightroom-3-2-and-camera-raw-6-2-available -on-adobe-labs.html Regards, Tom Hogarty Lightroom, Camera Raw and DNG Product Manager
-
Length of service calculation in payroll schema rules
SAP allows you a few options with regard to length of service in months. F01KJ looks at date type 01 in infotype 0041. It calculates months service based on complete months. If you use option "N" as opposed to "K", then it counts complete and parti
-
Error when uploading file : Return code = 6 in LSMW
Hello All, Getting the bleow mentioned error in LSMW. Error when uploading file Return code = 6 ) Is it related to access. please suggest.