I want to read a Matlab MAT file into labview.

I do not have Matlab.  I have a series of *.mat files that are created by another program that I want to read into LabVIEW.  The *.mat files should contain a very long 2 dimensional array of complex numbers, with only 2 columns.  I am hoping that the *.mat format is straight forward.  I need to read this into a LabVIEW array to manipulate it.
Has this been done?  I've found several routines that allow you to save data from LabVIEW into a *.mat file so that Matlab can read it, but I have not seen anything that goes in my direction.  Any help is appreciated.
Mike

Oh, yeah, that certainly makes a big difference.
You're even luckier that I was still bored, so I whipped something together.
See attached.
Couple of things:
(1) I couldn't test it for all data types so the "Parse Data" VI may need to be tweaked for some of the data types.
(2) Your file contained multiple variables and the one matrix of complex values was a 1D array so you may need to insert a "Transpose 2D Array" function where the bundle function is for your 2D array.
(3) A couple of the variables were character arrays but Matlab stores the individual characters as floating point numbers between 0 and 255 representing ASCII-encoded characters. These are the "XUnit" and "YUnit" arrays.
For your reference, the MAT file format is at http://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/matfile_format.pdf
Oh, I think I may have left breakpoints in when I saved the VI. Sorry about that. You should remove them when you run the VI so they don't become annoying.
Message Edited by smercurio_fc on 02-09-2006 05:07 PM
Attachments:
Read Level 4 MAT File.zip ‏69 KB

Similar Messages

  • Is it possible to read data from MATLAB *.mat file using LabVIEW?

    I have *.mat file from Matlab with some data. Does anybody know how to extract them from this file. I need to know the file format.
    Oleg Chutko.

    The Mathworks site is pretty good about having documentation for the formats of their file types. I recommend looking there for the format.

  • 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 KB

    Hi 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!

  • Reading Large Matlab files into LabVIEW

    Hi All,
    I am using the 'Open Data Storage [MATLAB] block to read data from a mat file into MATLAB. The data is very large (in the order of millions). When I try to run my vi which is relatively simple to read in and manipulate the data, my LabVIEW said it does not have enough memory. Is there any way to around this problem without physically increasing computer memory.
    Thanks in advance for any help and assistance.
    Chris

    Hi Chris,
    Did the 'not enough memory' happen on 'Open Data Storage' or 'Read Data' ?
    If it happened on the 'Read Data', you might want to try specifying 'index/count' inputs of the 'Read Data' to read channel values chunk by chunk.
    Best Regards,
    Mavis

  • I just want to read in a csv file and send it to an instrument at 1 Hz per line

    I want to read in a csv file that has pwr levels given at 1 Hz and append this using a format into string to the signal generator at 1 Hz. I just have never read in an entire file to automate the procedure. Thanks!

    duplicate post
    Please give time for people to respond. 

  • How do I migrate files created in a Windows OS to a new external drive that is formatted as a MAC drive. I want to read and write these files back to the new drive.

    How do I migrate files from an external hard drive created in a Windows OS to a new MAC external drive? I want to read and write these files to the new drive.

    LKrzesowski wrote:
    How do I migrate files from an external hard drive created in a Windows OS to a new MAC external drive? I want to read and write these files to the new drive.
    If all you're trying to do is move the files from the Windows external to the Mac external, you can simply connect them both to the Mac and drag the files from the Windows drive to the Mac drive. If you want to move the files back and forth between them, you'll need to establish the format of the Windows external. Macs can read and write to FAT32 and exFAT (which can handle files larger than 4GB) formatted drives but can only read NTFS formatted drives without additional software. With the Windows drive connected, you can check its format with Disk Utility.

  • How to read a whole text file into a pl/sql variable?

    Hi, I need to read an entire text file--which actually contains an email message extracted from a content management system-- into a variable in a pl/sql package, so I can insert some information from the database and then send the email. I want to read the whole text file in one shot, not just one line at a time. Shoud I use Utl_File.Get_Raw or is there another more appropriate way to do this?

    how to read a whole text file into a pl/sql variable?
    your_clob_variable := dbms_xslprocessor.read2clob('YOUR_DIRECTORY','YOUR_FILE');
    ....

  • I have written a binary file with a specific header format in LABVIEW 8.6 and tried to Read the same Data File, Using LABVIEW 7.1.Here i Found some difficulty.Is there any way to Read the Data File(of LABVIEW 8.6), Using LABVIEW 7.1?

    I have written a binary file with a specific header format in LABVIEW 8.6 and tried  to Read the same Data File, Using LABVIEW 7.1.Here i Found some difficulty.Is there any way to Read the Data File(of LABVIEW 8.6), Using LABVIEW 7.1?

    I can think of two possible stumbling blocks:
    What are your 8.6 options for "byte order" and "prepend array or string size"?
    Overall, many file IO functions have changed with LabVIEW 8.0, so there might not be an exact 1:1 code conversion. You might need to make some modifications. For example, in 7.1, you should use "write file", the "binary file VIs" are special purpose (I16 or SGL). What is your data type?
    LabVIEW Champion . Do more with less code and in less time .

  • To read data from exel file into sap

    hi all,
    How to read data from exel file into the internal table in abap?
    Regards,
    sugeet.

    Hi Sugeet,
    Use the following code.
    DATA : BEGIN OF tbl_asset occurs 0,
             anlkl LIKE anla-anlkl,          " Asset Class
             bukrs LIKE anla-bukrs,          " Company Code
             ranl1 LIKE ra02s-ranl1,         " Asset #
             txt50 LIKE anla-txt50,          " Description 1
             txa50 LIKE anla-txa50,          " Description 2
             sernr LIKE anla-sernr,          " Serial #
             invnr LIKE anla-invnr,          " Inventory #
             menge LIKE anla-menge,          " Quantity
             meins LIKE anla-meins,          " Base UOM
             inken LIKE anla-inken,          " Inventory
    END OF tbl_asset.
    DATA : w_filename TYPE IBIPPARMS-path,
           w_file     TYPE string.
    start-of-selection.
    *popup for file path from user
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
       PROGRAM_NAME        = SYST-CPROG
       DYNPRO_NUMBER       = SYST-DYNNR
    IMPORTING
       FILE_NAME           = w_filename          .
    MOVE w_filename TO w_file .
    * upload data
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      =  w_file
        FILETYPE                      = 'ASC'
        HAS_FIELD_SEPARATOR           = 'X'
      TABLES
        DATA_TAB                      = tbl_asset
      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.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    for HAS_FIELD_SEPARATOR Use
    'X': Fields are separated by tabs.
    SPACE: Fields are not separated by tabs. In this case, the table must contain only one column or all columns must be contained in the file in their entire length.
    Hope it helps...
    Lokesh
    Pls. reward appropriate points

  • How read data from *.LB File in LabVIEW?

    Hi dear specialist,
    How I can read data from  *.LB File in LabVIEW?
    Thanks` Hovo

    Thanks Ben, but when I open it as datalog file` comes following error:
    Error 71 occurred at Open/Create/Replace Datalog in Simple Temp Datalog Reader.vi
    Error 71 occurred at Open/Create/Replace Datalog in Simple Temp Datalog Reader.vi
    Possible reason(s):
    LabVIEW:  File datalog type conflict.
    C:\Documents and Settings\Home\Desktop\a.lb
    Here is an example of lb file (a.lb), and here is a VI for read datalog file(Simple Temp Datalog Reader.vi)
    What means this error?
    How I can read a byte at a time?
    Attachments:
    testForLB.zip ‏101 KB

  • Calling Matlab MEX Files in LabView ?

    What is the procedure to call a MATLAB MEX File in Labview?

    Nope Battler.
    I didnt find any help regarding Matlab MEX DLLs on that link by Chris.
    I presume if they are keeping mum, there is no solution possibly.
    Btw, I migrated my testing from LV to MSVC.
    Its a lot more easier to call  Matlab MEX DLLs from MSVC.
    http://www.mathworks.com/support/tech-notes/1600/1605.html

  • 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

  • Help! Want to read from a xl file and get an output voltage value!!!

    Hello..
    I`m a beginner, so please help..
    My program should output an voltage value that is read from an xl-file with one collum. The most important is that each values in the xl graph should be read per iteration. So that the file is read over time. I want to use this xl file to controll the output signal over time.
    Can anyone show me how this VI would look like, and what would the xl file look like??

    The easiest way to do this is to save your Excel file as a comma or tab separated text file and not the native Excel format. Then you can use Read From Spreadsheet File (on the File I/O palette). Using this, you can read the file all at once and then just have a 1D array that you can wire to a while or for loop so that with each iteration of the loop, you get one element in the array. A for loop automatically indexes an input array. Reading the file all at once will be more effecient that reading the file line by line.

  • Does anyone know how to read in a TDMS file into Matlab?

    I am trying to read a TDMS file into Matlab. Are the two compatible? How can I import this file into matlab?

    A search can turn up wonderful things, such as:
    Reading TDM/TDMS Files with The MathWorks, Inc. MATLAB® Software

  • I have an excel file,i want to read and write this file to xml

    hello,
    i have an excel file,i want to read excel data and write to xml file .i also have an exisitng xml file and i want to appened the excel data to the exisiting xml.please give some example code.
    thanks

    GoOgLe

Maybe you are looking for

  • EXIT command behaviour in ABAP code?

    Hi Experts, Pls. let me clarify that, the behaviour of EXIT command, like, - in IF statement - in LOOP - in PERFORM/FORM -in DO thanq

  • Create more than one link to a document

    I am a RoboHelp 6 user. I can only link to a Word document or PDF once, in other words if I create more than one link to a document, the second link is broken. I would appreciate it if anyone can tell me how I can get around this.

  • Standard driver programs,output type ,scripts,smartforms for SD reports

    hi experts,               Can any one list all the standard driver programs,output types ,scripts,smartforms for SD reports. mani

  • ANNC: Image Gallery Magic Now Available

    Picture perfect... Bring your images to life with the most powerful, feature-rich image gallery solution available for Dreamweaver: Image Gallery Magic by PVII - the leader in creative Dreamweaver extensions. Create image galleries from from inside D

  • Itunes Freezing with iPod sync

    Hi There, So when I plug my iPod into the computer and load up itunes. I get prompted with a unauthorization of a few songs (due to an older itunes account; I merged with my girlfriend) Secondly, it then proceeds to update all the songs on my iPod(al