Importing .m files to LabVIEW
Is it possible to import .m files of Matlab, directly in to LabVIEW?
Hai ITA,
c this link
Thanks,
Mathan
Similar Messages
-
Importing txt-files in Labview
Hello,
I am a beginner in programming labview applications so its possible my next question is very easy to program but i dont know how
My question is about importing a txt-file (csv-format) in labview. This txt-file is updated every 10 minutes and I want to visualise the last values every 10 minutes. These values must be written in several indicators (example: 10 coloms -> 10 indicators)
Next is a copy of the txt-file (this one is updated every second).
17/05/2005 0:00:03,-0.2015457,13.99473,88.62115,-108.5054,25.05078,25.98672,26.86344,-8.207347E-03,-0.9357101,-0.9123873,-0.9192927,
17/05/2005 0:00:04,-0.2015457,13.99473,88.62115,-108.5062,25.04688,25.98672,26.86344,-8.207347E-03,-0.9357101,-0.9123873,-0.9192927,
17/05/2005 0:00:05,-0.2015457,13.99473,88.62115,-108.507,25.04297,25.98281,26.86344,-8.207347E-03,-0.9357101,-0.9123873,-0.9192927,
17/05/2005 0:00:06,-0.2015457,13.99473,88.62115,-108.5085,25.04297,25.98281,26.86344,-8.207347E-03,-0.9357101,-0.9123873,-0.9192927,
17/05/2005 0:00:07,-0.1940842,13.99473,88.62115,-108.5085,25.04297,25.97891,26.86344,-8.207347E-03,-0.9357101,-0.9123873,-0.9192927,
I found a template (Load file from and display) thats displays a value from a txt-file.
In the block: "Read LabView Measurement File" its possible to select an option to read from a generic text file, with the right delimiter and decimal point sign (, and .) and when i press the button read file now i see the values in the txt-file. But when I run the program i get a error with possible reason "End of file encountered".
Next I put in the block "Wait until next ms Multiple" put still the same error appears.
So this doesnt work!
How can I solve my problem? Can somebody give me some usefull tips? Has someone else encountered this problem yet? ....
Thank you.
Regards,
Kevin Duerloo
Message Edited by Kevin Duerloo on 09-23-2005 04:49 AMSomnatic wrote:
Hi Kevin
Do you mind posting your VI ? Or are u only using the supplied example and nothing else ?
Could it be your programm (which creates the file) doesn't close it when it's done creating?
Try rebooting the system and immediately after that try the labview thing. Does the error still occur ?
Hello,
I'm only using the supplied example, the programm closes when it's done creating and rebooting doenst help.
The error means end of file encountered so i think the file isnt updated quick enough for labview. I'm going to try error handling like JorisV said. I will keep you informed if this works or doesnt (I have a lot work so this will not be earlier than tomorrow)
Thank you for the replies.
Kevin -
How to open a .MAT file in LABVIEW
Hey everyone,
I currently have a .MAT image file which I would like to open in LABVIEW to apply some image filters. However, I am unsure as to how to open the .MAT file in LABVIEW. Ideally I would like to be able to open the .MAT file without using matlab, and it seems the only way to accomplish this task is through the mathscript node. I have attached an example of the image im trying to open, as well as the LABVIEW program which I would like to use on the image. Thanks for the feedback! =]
Attachments:
MAT_Image_Adjust.zip 1779 KBHi Boiler,
1) Do you have a choice in the format you export your data from MATLAB?
"ASCII Format
Complete the following steps if you want to import or export data between LabVIEW and the MATLAB® environment, the process is straightforward as long as you are using ASCII format.
From the MATLAB® environment to LabVIEW
To save a vector or a matrix Xin ASCII format with tab delimiter, enter the following in the command window or m-script file in the MATLAB® environment:
>>SAVE filename X -ascii -double -tabs
This creates a file whose name is filename, and it contains the data X in ASCII format with a tab delimiter.
Import the file into LabVIEW using the Read From Spreadsheet File VI located on the Programming»File I/O palette.
2) Have you tried using the mathscript node? Did you get any errors?
"Binary Format
Complete the following steps if you want to import or export data between LabVIEW and MATLAB®.
From the MATLAB® environment to LabVIEW
To read a .mat file in LabVIEW would require a VI to parse the file. This may be easier if each variable is saved to a separate file.
" -- this was done here, no ideas if it still works,
I want to read a Matlab MAT file into labview
Hope this helps, James
Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! -
Import excel data for labview control
I'm having some trouble importing excel data into labview. Goals: Input valve flow rates into excel, use those values to control DAQ, have user balance odor with excel defined flow rate, export balance data to excel. Here is what I have so far. Any help is greatly appreciated.
Attachments:
Intensity.vi 162 KBWhere in the code are you reading from the Excel Spreadsheet? What VIs are you using? What are the problems are you experiencing (errors, unexpected values, etc.)?
There is a Read From Spreadsheet File.vi in LabVIEW. LabVIEW uses ActiveX controls for .xlsx files, so saving the spreadsheet as a CSV file may be better for this VI. Try it out! See what happens.
Here some more info on reading from spreadsheets:
LabVIEW Manual: Read From Spreadsheet File VI
KnowledgeBase article: How Can I Import Spreadsheet Files into LabVIEW using the .csv Format?
Taylor B.
National Instruments -
How can we import a text file in Labview,Is this process require CIN utility
Hi,
I am working in physics lab where i am working on labview and want to import a text file in labview, if anyone knows ,please mail me at [email protected]Hi Ajay,
See attached V 7.0 example...
Hope it helps,
Nick
Attachments:
Read_txt_File.vi 20 KB -
Importing and displaying DXF files into Labview
Dear all,
Building an application for motion control, I want to import a DXF file into labview to be used as a template for the motion. For verification I would also need to display it. I cannot use ActiveX properly bcse I develop on Mac....
If you have any idea or experience on how I might do this, I will be glad to hear from you !
Thanks in advance !
Regards,To display (not parse) DXF files and other CAD file formats (PRT, SLDASM, SLDDRW, SLDPRT) I've been using an ActiveX container with the EModelViewControl object from the free SolidWorks eDrawings. Use the OpenDoc method to display the file in the container (see attached snippet).
- Philip Courtois, Thinkbot Solutions
Attachments:
eDrawings snippet.png 21 KB -
I store different channels in a TDMS file.
I like to have a time channel at the first position with group index 1 and number 1.
When I read the TDMS file with DIADEM the time channel (Float64) is on a differernt position, and the channels are not sorted alphabetically.
Here are my questions:
How does DIADEM import TDMS files?
How gets every channel his number and groupindex?
How can I determine which channel has which groupindex and number?
Best regards
JoergHi Jörg,
i suppose that you´re programme whose create the *.tdms file is writing on false position. Try to create datas with timechannel on first indes in diadem, then save it and then open it again. you see that all is correct. So please tell me what programm in what version do you use and please attache it here.
Did you use the library for creating *.tdms files like in the link ?
http://zone.ni.com/devzone/cda/tut/p/id/6471
Here you find the gtdms_8.x.zip - when you extract it and opened the *.llb you find vi´s for all functions e.g. writing 2d array of strings to *.tdms file
when you open the subvi´s then you see how created and writing datas/structure to *.tdms files. Because *.tdms is binary you can´t see structure with open it in editor.
When you don´t have Labview you can use the 30 days test of current version 8.5 under following link
german version download link
https://lumen.ni.com/nicif/d/lveval/content.xhtml
english version download link
https://lumen.ni.com/nicif/us/lveval/content.xhtml
Hope it helps
Best Regards -
Plotting data from a text file in LabView 7.1
This my be a stupid question, but here is goes. Working with another person, far more LabView experience than I, a VI was created to take data and output it on the screen, real time, as an x-y plot. Once the test was completed the data was stored in an .txt file which could be read into Excel. Now the end user wishes to read the old data back into Labview with an x-y plot of the data, the same way it was displayed during the test. Before I started to pound my head against the wall, thought I would ask this to the group. Everyone has been very helpful in the pass, so hopefully this will be an easy question for the group.
The question is how do I import a text file into Labview and plot it on an x-y screen?
Thanks,
ScamperIt really depends on how you've saved the data. If you have a simple text file with x data in one column and y data in another, then you can use the code below. It's just a Read From Spreadsheet File, and Index Array, and Bundle function. Modify as needed for your actual data. If you get stuck, post a small example of your data file.
Message Edited by Dennis Knutson on 09-17-2008 11:10 AM
Attachments:
Read XY Graph.PNG 3 KB -
How do I apply a texture to an imported .stl file in 3D Picture Control?
Hi, I'm trying to apply a 2D image as a texture to an imported .stl file in 3D picture control. It works fine if I'm using a standard shaped mesh created in LabVIEW, however is there a way in which a texture can be applied to an imported model that isn't a standard shape, in my case a balloon. I've attached the an image of the Sub vi where I apply the texture. The object just shows up as a flat colour. Do I need to define how the image is applied to the mesh due to it being a non-standard shape? If so, any pointers would be appreciated.
Many thanks.
Oh, I'm using LabVIEW 2009 SP1.
Attachments:
stl texture problem.jpg 60 KBApologies, been trying all afternoon and then a couple of minutes after posting, I figured it out. Using a property node for the Scenemesh reference, I set the property TextureGenMode to Spherical and it appears to now display the texture on the mesh.
-
How to import Verilog codes into LabVIEW FPGA?
I tried to import Verilog code by instantiation followed by the instruction in http://digital.ni.com/public.nsf/allkb/7269557B205B1E1A86257640000910D3,
but still I can see some errors while compiling the VI file.
Simple test Verilog file is as follows:
==============================
module andtwobits (xx, yy, zz);
input xx, yy;
output reg zz;
always @(xx,yy) begin
zz <= xx & yy;
end
endmodule
==============================
and after following up the above link, we created the instantiation file as
==============================================
library ieee;
use ieee.std_logic_1164.all;
entity mainVHDL is
port(
xxin: in std_logic;
yyin: in std_logic;
zzout: out std_logic
end mainVHDL;
architecture mainVHDL1 of mainVHDL is
COMPONENT andtwobits PORT (
zz : out std_logic;
xx : in std_logic;
yy : in std_logic);
END COMPONENT;
begin
alu : andtwobits port map(
zz => zzout,
xx => xxin,
yy => yyin);
end mainVHDL1;
==============================================
Sometimes, we observe the following error when we put the indicator on the output port,
ERROR:ConstraintSystem:58 - Constraint <INST "*ChinchLvFpgaIrq*bIpIrq_ms*" TNM =
TNM_ChinchIrq_IpIrq_ms;> [Puma20Top.ucf(890)]: INST
"*ChinchLvFpgaIrq*bIpIrq_ms*" does not match any design objects.
ERROR:ConstraintSystem:58 - Constraint <INST "*ChinchLvFpgaIrq*bIpIrq*" TNM =
TNM_ChinchIrq_IpIrq;> [Puma20Top.ucf(891)]: INST "*ChinchLvFpgaIrq*bIpIrq*"
does not match any design objects.
and interestingly, if we remove the indicator from the output port, it sucessfully compiles on the LabVIEW FPGA.
Could you take a look at and please help me to import Verilog to LabVIEW FPGA?
I've followed the basic steps of instantiation on the above link, but still it won't work.
Please find the attachment for the all files.
- andtwobits.v : original Verilog file
- andtwobits.ngc: NGC file
- andtwobits.vhd: VHD file after post-translate simulation model
- mainVHDL.vhd: instantiation main file
Since there is no example file for Verilog (there is VHDL file, but not for Verilog), it is a bit hard to do the simple execution on LabVIEW FPGA even for the examples.
Thank you very much for your support, and I'm looking forward to seeing your any help/reply as soon as possible.
Bests,
Solved!
Go to Solution.
Attachments:
attach.zip 57 KBHi,
I am facing problem in creating successfully importing VHDL wrapper file for a Verilog module,into LabVIEW FPGA using CLIP Node method. Please note that:
I am working on platform SbRIO-9606.
Labiew version used is 2011 with Xilinx 12.4 compiler tools
NI RIO 4.0 is installed
Xilinx ISE version installed in PC is also 12.4 webpack ( Though I used before Xilinx 10.1 in PC for generating .ngc file for verilog code FOR SbRIO 9642 platform, but problem remains same for both versions)
Query1. Which versions of Xilinx ISE (to be installed in PC for generating .ngc file) are compatible with Labview 2011.1(with Xilinx 12.4 Compiler tools)? Can any version be used up to 12.4?
Initially I took a basic and gate verilog example to import into LabVIEW FPGA i.e. simple_and.v and its corresponding VHDL file is SimpleAnd_Wrapper.vhd
///////////////// Verilog code of “simple_and.v”//////////////////////
module simple_and(in1, in2, out1);
input in1,in2;
output reg out1;
always@( in1 or in2)
begin
out1 <= in1 & in2;
end
endmodule
/////////////////VHDL Wrapper file code of “SimpleAnd_Wrapper.vhd” //////////////////////
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY SimpleAnd_Wrapper IS
port (
in1 : in std_logic;
in2 : in std_logic;
out1 : out std_logic
END SimpleAnd_Wrapper;
ARCHITECTURE RTL of SimpleAnd_Wrapper IS
component simple_and
port(
in1 : in std_logic;
in2 : in std_logic;
out1 : out std_logic
end component;
BEGIN
simple_and_instant: simple_and
port map(
in1 => in1,
in2 => in2,
out1 => out1
END RTL;
Documents/tutorials followed for generating VHDL Wrapper file for Verilog core are:
NI tutorial “How do I Integrate Verilog HDL with LabView FPGA module”. Link is http://digital.ni.com/public.nsf/allkb/7269557B205B1E1A86257640000910D3
In this case, I did not get any vhdl file after “post-translate simulation model step” in netlist project using simple_and.ngc file previously generated through XST. Instead I got was simple_and_translate.v.
Query2. Do I hv to name tht “v” file into “simple_and.vhd”?? Anyways it did not work both ways i.e. naming it as “simple_and with a “v” or “vhd” extension. In end I copied that “simple_and.v” post translate model file, “simple_and.ngc”, and VHDL Wrapper file “SimpleAnd_Wrapper.vhd” in the respective labview project directory.
Query3. The post-translate model file can also be generated by implementing verilog simple_and.v file, so why have to generate it by making a separate netlist project using “simple_and.ngc” file? Is there any difference between these two files simple_and_translate.v generated through separate approaches as I mentioned?
2. NI tutorial “Using Verilog Modules in a Component-Level IP Design”. Link is https://decibel.ni.com/content/docs/DOC-8218.
In this case, I generated only “simple_and.ngc” file by synthesizing “simple_and.v “file using Xilinx ISE 12.4 tool. Copied that “simple_and.ngc” and “SimpleAnd_Wrapper.vhd” file in the same directory.
Query4. What is the difference between this method and the above one?
2. I followed tutorial “Importing External IP into LABVIEW FPGA” for rest steps of creating a CLIP, declaring it and passing data between CLIP and FPGA VI. Link is http://www.ni.com/white-paper/7444/en. This VI executes perfectly on FPGA for the example”simple_and.vhd” file being provided in this tutorial.
Compilation Errors Warnings received after compiling my SimpleAnd_Wrapper.vhd file
Elaborating entity <SimpleAnd_Wrapper> (architecture <RTL>) from library <work>.
WARNING:HDLCompiler:89"\NIFPGA\jobs\WcD1f16_fqu2nOv\SimpleAnd_Wrapper.vhd" Line 35: <simple_and> remains a black-box since it has no binding entity.
2. WARNING:NgdBuild:604 - logical block 'window/theCLIPs/Component_ dash_Level _IP_ CLIP0/simple_and_instant' with type 'simple_and' could not be resolved. A pin name misspelling can cause this, a missing edif or ngc file, case mismatch between the block name and the edif or ngc file name, or the misspelling of a type name. Symbol 'simple_and' is not supported in target 'spartan6'.
3. ERROR:MapLib:979 - LUT6 symbol "window/theVI/Component_dash_Level_IP_bksl_out1_ind_2/PlainIndicator.PlainInd icator/cQ_0_rstpot" (output signal=window/theVI/ Component_dash_Level _IP_bksl_out1_ ind_2/PlainIndicator.PlainIndicator/cQ_0_rstpot) has input signal "window/internal_Component_dash_Level_IP_out1" which will be trimmed. SeeSection 5 of the Map Report File for details about why the input signal willbecome undriven.
Query5. Where lays that “section5” of map report? It maybe a ridiculous question, but sorry I really can’t find it; maybe it lays in xilnx log file!
4. ERROR:MapLib:978 - LUT6 symbol "window/theVI/Component_dash_Level_IP_bksl_ out1_ind_2/PlainIndicator.PlainIndicator/cQ_0_rstpot" (output signal= window / theVI/Component_dash_Level_IP_bksl_out1_ind_2/PlainIndicator.PlainIndicator/ cQ_0_rstpot) has an equation that uses input pin I5, which no longer has a connected signal. Please ensure that all the pins used in the equation for this LUT have signals that are not trimmed (see Section 5 of the Map Report File for details on which signals were trimmed). Error found in mapping process, exiting.Errors found during the mapping phase. Please see map report file for more details. Output files will not be written.
Seeing these errors I have reached the following conclusions.
There is some problem in making that VHDL Wrapper file, LabVIEW does not recognize the Verilog component instantiated in it and treat it as unresolved black box.
Query6. Is there any step I maybe missing while making this VHDL wrapper file; in my opinion I have tried every possibility in docs/help available in NI forums?
2. Query7. Maybe it is a pure Xilinx issue i.e. some sort of library conflict as verilog module is not binding to top VHDL module as can be seen from warning HDLCompiler89. If this is the case then how to resolve that library conflict? Some hint regarding this expected issue has been given in point 7 of tutorial “How do I Integrate Verilog HDL with LabView FPGA module”. http://digital.ni.com/public.nsf/allkb/7269557B205B1E1A86257640000910D3. But nothing has been said much about resolving that issue.
3. Because of this unidentified black box, the whole design could not be mapped and hence could not be compiled.
P.S.
I have attached labview project zip folder containing simple_translate.v, simple_and_verilog.vi file,SimpleAnd_Wrapper.xml, Xilinx log file after compilation alongwith other files. Kindly analyze and help me out in resolving this basic issue.
Please note that I have made all settings regarding:
Unchecked add I/O buffers option in XST of Xilinx ISE 12.4 project
Have set “Pack I/O Registers into IOBs” to NO in XST properties of project.
Synchronization registers are also set to zero by default of all CLIP I/O terminals.
Please I need speedy help.Thanking in you in anticipation.
Attachments:
XilinxLog.txt 256 KB
labview project files.zip 51 KB -
Which ActiveX command do I use to IMPORT TEST FILES INTO EXCEL?
Happy New Year!
I am trying to write large data files to XL, but they take very long to write. Now I am trying to write text files and then near the end of teh program import them into an Excel file. IS there an ActiveX command I should use for this (invoke node)?
Thank-you!
IvankaYes, you can do it.
1. Write a simple VBA procedure in Excel to import text file (or, you can use the macro recorder in Excel to do it) and very it works properly.
2. Copy the code into a string constant in your Labview code. The code must contains "Sub ... End Sub"
3. while you are sting inside Excel, disable Excel macro security check to make it to setting "low"
3. If you have report generation toolkit, then there are three methods: Excel Import Module, Run Module and Remove module. Wire those in sequence with all the appropriate inputs. I'm sure there are corresponding method in Excel ActiveX but could not remember it.
4. test it and modify it until it works
Joe
Attachments:
Snap1.gif 6 KB -
hello everybody,
I want t view dicom image files in labview, i tried downloading dicom sdk's of activex, then i tried to import Dcsdk through tools palette,which i couldnt do it. Can anyone please tell me the way to proceed. I have dicom software installed in my pc and i also have some dicom image files.Hi,
I would like to suggest you to go through the forum post where you can find the link for the DICOM code example written in Labview.
Kind regards
Marek S. -
Read access mdb file in labview via ADO/DAO problem
Hi guys,
I am now facing one problem that I want to import ACCESS database (ver2000) files into labview and turn it into tables.
but if I use ADO(actually using LABSQL) I have to create the ODBC in control panel, if I use DAO, I don't know how to call the activeX method.
I would like to realize like this:
choose in a directory which mdb file I would like to open, and then open it and show it in a labview table, but using AD0 I have to create connection for each file, does it stand a chance to open it without specify the connection in control panel?
He LiangYou can use a Connection String defined by you like this
You can get the basic connection string by creating a UDL file and editing that file in Wordpad.
Hope this helps
David
Message Edited by David Crawford on 11-27-2006 01:04 PM
Attachments:
Connection String.jpg 13 KB -
I would like to run Matlab mex file in Labview - how to do this?
Hello
In order to run Labview without Matlab beeing installed I have to compile the matlab files, right? So I also want to run those files in Labiew, and I do not know how. Anybody can help.
Thanks a lot
kind regards
PawelPawel,
You can create a DLL in Matlab. To compile this DLL you should use both LabVIEW and Matlab typedefs. The Math Works offers a C library with functions for accessing Matlab files. You can use this library to create a DLL. Then import the DLL into LabVIEW by using Call Library Function VI located under Functions>>Advanced palette.
To call Matlab scripts from within LabVIEW, you have to have Matlab installed on the machine. The Script Node (Matlab script) function is located in Functions>>Mathematics>>Formula palette.
Here are some useful links:
- description of those C functions
[http://www.mathworks.com/access/ helpdesk/help/techdoc/apiref/apiref. shtml]
- how to download and compile (it will be a little bit different if you want to use CIN)
[htt
p://www.mathworks.com/support/ solutions/data/8757.shtml]
- MAT-file format if you want to develop your own LabVIEW utility to do the job
[http://www.mathworks.com/access/ helpdesk/help/pdf_doc/matlab/ matfile_format.pdf]
Hope these suggestions pointed you in the right direction.
Zvezdana S.
National Instruments -
Hello,
I would like to import tdms file (Labview version 2009) into Matlab (R2012a). I tried to follow a few solution given in this forum, however I couldn't find any that could help me.
I hope anyone can give guidance on how to import these file.
Many thanks
Best regards
Hafisohfie wrote:
Thanks to all for the advice..
If you really want to thank them, give them kudos, and mark the answer to the question.
Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.
Maybe you are looking for
-
How to edit the existing data in the XML file from java programming.
Hi all i am able to create XML file with the sample data as below from java programming. i need sample code on how to edit the existing data in the XML file? for example <?xml version="1.0"?> <mydata> <data1> <key1>
-
OutofMemory Error while sending file to database using Web services
I have a file of 30MB to be written to the MySQL database. I am doing this in Axis web services and it gives me the following error: (I am using Tomcat as the application server and Apache as the web server, Axis 1.3 and MySQL standard 5.0.21 version
-
PDF Link on website no longer working
I have a link on my website that opens a PDF file. On a few computers the link will not open or it will open and then freeze. Or my favorite "the file is damaged and can not be repaired." Where do I start looking for a solution? I am using CS4 an
-
Cant view all emails on setting up TB
I have just set up TB for by BT & 3 other accounts. The 3 other accounts all seem fine. BT messages are all now showing in TB apart from 1 subfolder of my inbox. The folder is showing but it is empty. Have checked where my profile is stored & the mes
-
My iPhone was stollen this afternoon. I'm wondering if anyone can teach me how to synchronise my iPhone content to my iPad? Thank you.