Matlab script image support?

Hi there,
I'm trying to use the imread function in the matlab script node to translate an 8-bit image into a intensity-value matrix. It works in normal matlab, but not in the node. I can't find the imread function in any of the labview help menus, so I was wondering if labview supports that function at all. If not, does anyone have any suggestions for automating getting the image into matrix form? Thank you,
Stephanie

Hello Stephanie,
Are you using the same script in the node as you use in the MATLAB® software?  What is the error returned by the node?  Are you running the VI on the same machine where you tested the script in the MATLAB software?  The imread function does seem to be part of the Image Processing Toolbox, so you will need to ensure that this toolbox is installed on any machine that you intend to use to run your VI.
The LabVIEW MathScript node is a textual node and its syntax is generally compatible with the m-script syntax used by other technical computing software.  Jeff is correct in that LabVIEW MathScript does not currently support the imread function.  However, it will likely be added in a future version of LabVIEW.  If you are looking for a solution in graphical code, LabVIEW does provide some VIs for reading and writing PNG, JPEG, and BMP files.  You can find the VIs in the Programming >> Graphics & Sound >> Graphics Formats palette.  You can then use the Unflatten Pixmap VI to get a matrix representation of your image.
National Instruments also produces a Vision Development Module for LabVIEW that includes more advanced image acquisition (IMAQ) and image processing functionality.  This module is more for industrial and scientific use than for duplicating what might be provided in desktop image manipulation programs.
MATLAB® is a registered trademark of The MathWorks, Inc.
Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments

Similar Messages

  • Matlab Script in LV 8.0 for 'SIM Command'

    Dear all
    I have problem using Matlab Script in LabVIEW 8.0 for 'SIM(Model, Final Time)' command.
    1. Does Matlab Script Server supports all the functions in Matlab 7.0.1?  I runned 'SIM(Model, Final Time)' on the LabVIEW Script, but no results obtained. It is supposed to get a figure output there.
    2. If I run some function in Matlab Script with input parameters. Do I have to set these parameters in Matlab Script of LabVIEW as 'Input' or I can set them in Matlab Workspace first then apply them directly. Since some of my parameters are classified as structure class. They won't allow me to use them in Script as 'Input'.
    Thanks for your help!

    Good morning,
    Thank you for posting. 
    I believe that you are using the MathScript node, but I am a little uncertain:
    If you are using Mathscript, you do not need to do anything
    with any ‘server’, but the particular function you request may not be
    implemented.  Which type of node are you
    using?  If you are using Mathscript, and
    the function is not implemented, feel free to request it – we are happy to
    consider implementing it for a future version of LabVIEW.  If you are using the MATLAB Script Node, I
    suspect the problem is with the way the node is setup, or with the ActiveX
    server.
    Again, thanks for posting-
    Message Edited by Travis M. on 07-18-2006 10:37 AM
    Travis M
    LabVIEW R&D
    National Instruments
    Attachments:
    untitled.JPG ‏62 KB

  • Traité une image par matlab script sur Labview

    salut!! j'ai un programme Matlab qui fait le traitement d'image , je veux l’exécuter sous Labview et recevoir le resultas sous Labview auss . je sais pas comment faire la conversion Array to image si quelqu'un Peut m'aider Merci !!
     ci joint le programme utilise 
    Attachments:
    Matlab script.jpg ‏59 KB

    Hello !!
    sorry for being late in my answer , I had to finnish other work!! and thank you for answering 
    here are the uses of  the functions that you asked me,   from the help of Matlab !!
    IMFILTER N-D filtering of multidimensional images.
    B = IMFILTER(A,H,OPTION1,OPTION2,...) performs multidimensional
    filtering according to the specified options.
    Options are:
    'circular'        Input array values outside the bounds of the array are computed by implicitly assuming the input array is periodic.
    'conv'            IMFILTER performs multidimensional filtering using convolution.
    DECONVWNR      Deblur image using Wiener filter.
    J = DECONVWNR(I,PSF)   deconvolves image I using Wiener filter algorithm,
                                             returning deblurred image J. The assumption is that the image I was
                                             created by convolving a true image with a point-spread function PSF and
                                             possibly by adding noise. The algorithm is optimal in a sense of least
                                             mean square error between the estimated and the true images, and
                                             utilizes the correlation matrixes of image and noise. In the absence of
                                             noise, the Weiner filter reduces to the ideal inverse filter.
    Finally as you can see in the archives joined to this message , the results of Matlab and Labview are different , so i think that the problem is with the conversions of the type inLabview  from image to array and array to image where i lose information of the image.
    have a nice day !! 
    thank you !!
    Attachments:
    matlab vs Labview results.zip ‏2487 KB

  • IMAQ FFT multiplication and MATLAB Script Nodes/Compact Rio

    I would like to automatically generate a frequency kernel to multiply with the FFT of my IMAQ image. I was wondering if there was a way for LabVIEW to automatically set up 2D arrays (with a lower bound, a step size and a higher bound) like what is done in MATLAB.
    I was wondering also, if someone could give me some insight as to what restrictions I face, when uploading code from MATLAB script nodes into the Compact RiO (I have a cRiO-9025).

    Hi Bilaln,
    I think you confused about a MATLAB script node and a Mathscript node.
    A MATLAB script nodes uses ActiveX to call into MATLAB, where as a Mathscript node runs in a NI built environment. The MATLAB script node requires both that MATLAB be installed and the host supports ActiveX. Since cRIO does not do either, you should use the MATHSCRIPT RT module.
    Joe Daily
    National Instruments
    Applications Engineer
    may the G be with you ....

  • Input data type of Matlab script node

    Hi,
    I have 1D array of complex number in single precision.
    Matlab script node is used to import data into Matlab and do some data processing, and then export.
    Data type of input is currently double precision.
    How to re-define this input data type of the Matlab script node?
    Thanks,

    Right, arrays of singles are not supported. See Comparison of MathScript RT Module and the MATLAB® Software Data Types in LabVIEW
    As for memory usage, Profiling the VI should let you know how much memory Labview uses when running your code. Communication with MATLAB® is done through ActiveX, and I'm actually not 100% sure whether it will reflect memory usage from script execution. I think it'll be simple enough to profile your VI with and without the MATLAB Script node and note the memory usage difference...
    Misha

  • Using Matlab script in Labview

    Hello,
    I am trying to use matlab script in labview to post process the sampled signals from DAQ(attached is the vi I tried)
    After every 10 seconds I want to the send the sampled voltage data to matlab scritp block which does 1) detection of peaks using peakdetection function and plots the obtained peaks on the sampled signal 2) calculates standard of 10 secs data and plots on chart.
    But I am confused of 1) how to call the peakdetection function inside the matlabscript block
    2) How to send the 10secs data of voltage and time values to the matlab script block
    3) How to plot the signal and detected peaks on the same plot (which can be done in matlab using holdon as shown in the atached vi).
    Can someone suggest for implementing these .
    Thanks.
    Solved!
    Go to Solution.
    Attachments:
    Labview&Matlab.vi ‏55 KB

    Thanks  GabeG,
    Now, Labview&Matlab_TestNoAq.vi  is woking Good and for the second one  Labview&Matlab_TestAq.vi it is showing error as shown in the attached image when these ines of code are present in the matlab scrtip 
    subplot(2,1,1),plot(maxtab(:,1),maxtab(:,2),'*r');
    SDN=std(maxtab(:,1));
    and SDN output of the Matlab script
    but when I removed these it is working fine(but not showing the detected peaks).
    Can you suggest me a solution for the above and also can I know the best method to add one more channel that samples another device signal which has to be processed in this same way(Signals sampled from 2 devices have to be porcessed in this same way).
    Thanks.
    Attachments:
    Script_Error.JPG ‏133 KB

  • Compiling VIs with Matlab scripts

    Hi everyone,
    I need to build application for a VI with some matlab scripts included in the block diagrams using the Matlab scripts node. I've been searching for related topics and I'm hoping someone can help me understanding the big picture here.
    Background info: I'm using LV2012, Matlab 2013. I DON'T USE MathScript RT Module.
    Question:
    1. To build a stand-alone application for the use on a PC with Matlab software but no LabVIEW, do I just simply build the application in LabVIEW project?
    2. To build a stand-alone application for the use on a PC wthout Matlab and LabVIEW, do I need to create a DLL from Matlab and modify my VI to use "Call library function node" and then build the application in LabVIEW project?
    Thanks for answering my questions!

    Question:
    1. To build a stand-alone application for the use on a PC with Matlab software but no LabVIEW, do I just simply build the application in LabVIEW project?
    Yes,  Assuming it is a windows machine and the Licensed version of Matlab is version 6.5 or later the LabVIEW Run-Time engine knows how to call the Matlab script server through Active X.
    2. To build a stand-alone application for the use on a PC wthout Matlab and LabVIEW, do I need to create a DLL from Matlab and modify my VI to use "Call library function node" and then build the application in LabVIEW project?
    You cannot use a Matlab math script node without a licensed version of Matlab 6.5 or later resident on the target and the target must support Active X so, Windows only.
    Jeff

  • Error 1050 by trying to use load'filename' in matlab script node

    Hi
    I keep getting error 1050 when Labview tries to load a text file through the matlab script node.
    I've all ready checked for it on google and this forum but found nothing. I've also done this: http://digital.ni.com/public.nsf/allkb/2B3FF46C8512C4F786256CF30071BE53 and tried to use dlmread and more. 
    The thing is that  I need the matlab script node to read a txt file that Labview made from a chart with only 1 array, plot it and export a jpg image. I can't really use the 'export image' or 'get image' function in Labview cause I need the whole plotted chart (these functions only take a snap shot of it when they're run).
    This is my code that I'm using:
     data=load('file') ;
    Vpp=(data(1:2000,1));
    xsize = (1/2000);
    plot(0.0005:0.0005:1,Vpp);
    axis([0 1 -5 5]);
    print('-djpeg', 'graph.jpg');
    The usual load in matlab to load txt files and print to print the jpeg. The code works in matlab but not in labview
    And yeah, I'm using windows 7 and legal versions of matlab r2009b and Labview 2009  
    Solved!
    Go to Solution.
    Attachments:
    matlab.jpg ‏213 KB

    Yes I forgot, this is my error...  It looks like it can't read the file path, but the 'file' path is actually just a path to my c:\user\*\*\*\*.txt 
    Error 1050 occurred at LabVIEW:  Error occurred while executing script. Error message from server: ??? Error using ==> load
    Unable to read file file: No such file or directory.

  • Outputting of of a Matlab Script

    Hello everybody
    I am working on a project for school and had a question as far as outputting out of a Matlab Script node. I have data that is stored in the form T(:,:,i) so it is a 3D data that is calculated within the the script. 
    The main thing I am wanting to do is output the data so I can graph it on a Labview front panel. I want to display a 2d image with a third dimension respresented as points on that 2d image. (2d as space with 3rd dimension being temperature).
    It may not make sense why I am doing this in Labview but I have an entire GUI built for Labview and this is just one snippet of the things that I want to show. I included a file for the particular graphs I am trying to ultimately display. 
    I apologize I am still learning the ropes to Labview.
    Solved!
    Go to Solution.
    Attachments:
    PowerSimForForum.vi ‏11 KB

    Hi Jakeyboy1,
    Below is a link that demonstrates how to send a 3-Dimensional array from LabVIEW, however you should easily be able to modify the block diagram in the article to switch the processes.  In the article, the example code first auto-indexes a 3D array to assign T(:,:,i) within the script environment.  Then LabVIEW uses another script node to process the built 3-Dimensional array.
    You can switch this process.  Out of the first script node wire out the length of the 3rd dimension and feed that into the N terminal of a for loop.  Within the for loop place the script node which reads T(:,:,i) and outputs the 2D array from the node.  You can wire this out of for loop and autoindexing should creat the 3D array in LabVIEW.  Since the N terminal matches the length of the 3rd dimension.  The resulting array in LabVIEW should be identical.
    Send N-Dimensional Arrays into a MATLAB® Script Node
    Regards,
    Isaac S.
    Applications Engineer
    National Instruments

  • Matlab script error 1050

    Hi All,
    I am using MATLAB Script in LabVIEW. But there is error 1050. 
    Could you take my attached script and figure it out for me? Thanks a lot!
    elephant
    Attachments:
    MATLAB SCRIPT Error.png ‏35 KB

    I am also getting error 1050. The script works fine in Matlab with the same parameters. But in Labview, the following error occurs :
    Error 1050 occurred at LabVIEW:  Error occurred while executing script. Error message from server: ??? Error using ==> mtimes
    Inner matrix dimensions must agree.
    Error in ==> linspace at 22
    y = [d1+(0:n-2)*(d2-d1)/(floor(n)-1) d2];
    . in wgm_Individual_RootSearch.vi
    The script is:-
    format longEng
    [Lre Lim]=meshgrid(lambda0_re,lambda0_im);
    row=0;
    col=0;
    R_=zeros(N1,N2);kco=zeros(N1,N2);kc=zeros(N1,N2);M1=zeros(N1,N2);M2=zeros(N1,N2);
    mn=1e5;%minimum value
    while(mn>tol)
    L=Lre+1i*Lim;%L becomes a 2D mesh with all possible combinations of real and imag
     kco=(2*pi./L)*nco;
            kc=(2*pi./L)*nc;
            M1=nco/2*(besselj(m-1,kco*p1)-besselj(m+1,kco*p1))./besselj(m,kco*p1);
            M2=nc/2*(besselh(m-1,1,kc*p1)-besselh(m+1,1,kc*p1))./besselh(m,1,kc*p1);
            R_=abs(M1./M2 -1)';
    mn=min(R_();
    [row col]=find(R_==mn);
    Dr=lambda0_re(N1)-lambda0_re(1);
    Di=lambda0_im(N2)-lambda0_im(1);
    Lr=lambda0_re(row);
    Li=lambda0_im(col);
    lambda0_re=linspace((Lr-(Dr/20)),(Lr+(Dr/20)),N1);
    lambda0_im=linspace((Li-(Di/20)),(Li+(Di/20)),N2);
    [Lre Lim]=meshgrid(lambda0_re,lambda0_im);
    end
    r=lambda0_re(row);
    c=lambda0_im(col);
    Any hints will be really appreciated.. Where am I going wrong please let me know. Thanks  a lot.
    The parameters are in the screenshot below:

  • Matlab script sever don't work in labview

    in my application ,matlab script always doesn't work with a error1050,even the matlab script examples in labview help examples also can't work at all, can you
    tell me the reason.

    Marc,
    You have one forgotten possibility to communicate LabView with remote
    MATLAB - it is TCP/IP.
    It is easy to realize and may be helpful in your application.
    Regards,
    Sergey.
    "Marc" wrote in message
    news:[email protected]..
    > Hi Sergey
    >
    > Yep the files look interesting - as well as the control. The actual
    > application is to make sure we have realtime data exchange along with
    > 'callback' functionality. There are a variety of approaches - reading
    > mat files, using DDE and COM. NetworkDDE is not supported by matlab -
    > so that is one option gone. Using shared network drives is a solution
    > - but still means Matlab and Labview are mutually dependant. With DC
    OM
    > (and Matlab in /Automation mode) it is possible to have two 'masters'
    > talking independantly without shared network drives...
    > I think at the end I will have to construct a new control (or cin)
    > module to do this...
    > Marc

  • Intermittent issues with Matlab Script in LV2012

    I'm having some intermittent issues with the Matlab Script in LV2012.  I'm running Windows 7 64 bit, and my Matlab is 2013 64-bit.  I've tried the suggestion here:
    http://digital.ni.com/public.nsf/allkb/8BEBC0C86541224286257AF300561B5E
    I tried this but it didn't work for me. 
    I've also looked at this:
    http://digital.ni.com/public.nsf/allkb/2B3FF46C8512C4F786256CF30071BE53?OpenDocument
    In one of my .vi's if I change 2 of the 3 input variables to the complex type, it works.  It seems to be insensitive to the data type of the first input variable.  In another .vi this trick doesn't work at all.  The fix given in the link is to update the .dll, but this seems to be old news as the .dll in my directory is newer than the one referenced in this link.
    The other funny thing is these scripts worked fine on Friday afternoon, but were throwing this error this morning.  I've closed and reloaded both Labview and Matlab, but that didn't fix the issue.
    Are there any new fixes for this issue that I haven't been able to find?
    Thanks,
    Doug

    Doug,
    If you have a service contract feel free to call in to the support line and you'll be able to work with someone on the phone. That'll be the quickest way to resolution.
    Feel free to send me a PM if you wish and I can take a look at the code and test it on our machine. 
    Notes for Branch AE:
    Please reply to This Post within 24 hours
    The US AE is expected to reply to all of your posts within 24 hours. Having this expectation will keep the escalation moving quickly and toward a fast resolution.
    You can also use other communication channels: Phone, Sametime, Lync,etc. to discuss the issue with the US AE. This can help with troubleshooting and quick diagnosis of the issue.
    Click here to provide kudos for a post on this page

  • Get a better feedback from matlab script

    Hi everyone,
    I'm using matlab script from LabView. It seems to work, my server receives correct data but I would like to get some useful outputs. For instance, for debugging purpose, I'd like to be able to get messages sending by fprintf. And more generally, I could see if my script is crashed or running.
    Any idea?

    I "improved" my program by using as often as possible LabView to let Matlab just do the computation (LV is opening image, reading data sheet and send it as input for Matlab).
    And, as you've said, I split my big script into several one which is really better.
    Though, the main computation lasts 2min and it s a pity to wait such a long time without being sure of what's happening.
    One "solution" is to use a 'STEP' variable which is incremented along the computation under Matlab and use it as an output/indicator for LabView. So, if step didn't reach its max, it means that you can go back to debugging.
    An idea for LabView 8.0: create a kind of screen able to receive the standard output of Matlab

  • Retrieving data from a MATLAB script node

    I am creating a VI that imports and manipulates arrays of data points and then plots them in Labview. When I run my Matlab script in Matlab there are no errors and all the assigned variables exist in the form that they should exist but for some reason Labview cannot retrieve all of them (they just show up as zeros). There are no errors in the script as far as I can tell. Do you have any idea what could be going wrong?

    Hi,
    You can use the MatLAB window opened by LabVIEW to debug your script.
    Check the values of your variables in the MatLAB window and try to find out where the data goes wrong. I've experienced many problems with LabVIEW MatLAB nodes on different PCs, and many times legal MatLAB operations would go wrong in the script node. You will need to find out which line exactly does your MatLAB code not executing correctly and try to modify the MatLAB codes from there.
    Hope this help,
    Dan

  • No script engine supported for 'JScript' error in OBIEE 11G ibots

    Infrastructure: 64 bit OBIEE 11.1.1.5 on 64 bit Red-Hat Enterprise Linux 5.6
    We tried using *.java to export the delivery content of an 'Agent' and place it in a shared folder on Windows.
    We are able to use the .java file directly in putty and it works fine in creating a folder and copying the file from source to target, but when we put the same script as part of the actions in the 'Agent' properties, its fails with the error "[nQSError: 66023] No script engine supported for 'JScript'". The e-mail is triggered and the attachment is delivered fine.
    We tried the same with a *.js file. The error is the same. I found people using *.js scripts and they say it worked for them at Re: How to send the content of an agent (PDF Report) to local machine in 11g
    But I am not sure what are the other settings that should be done. The error seems very basic and fundamental and has something to do with java interpreter or something.
    Any help if you have implemented the same, would be greatly appreciated.
    Thanks!

    That example in the link shows creating an action at the end of 'Agent'. I am not sure if that is what the user meant by 'create an action'. If the user meant to create an 'action', how does and where we call that action at the end of an 'Agent'?
    I did try creating an action by updating the 'UserScript.js' file, but the moment i update the file with a custom function, the server doesnot recognise the UserScript.js file anymore and i cannot even use the default functions in UserScript.js file.

Maybe you are looking for

  • How do I use a foot pedal with my mac?

    how do I use a foot pedal with my mac to use on YouTube?

  • Enabling IPv6 on Solaris 8.0 workstations

    Hi, I recently had Solaris 8.0 installed on two SUN Ultra 5 workstations. Unfortunately I was not present when they were installed and the installer did not know how to enable IPv6 onto the NIC cards. How do I go about checking if v6 was enabled and

  • Show/hide behavior is gray

    I have a series of VERY simply constructed pages to which I would like to add hidden layers that appear on selection of text. Two things seem out of the ordinary to me. First, my behaviors menu doesn't allow me to select "show/hide layer." I haven't

  • Reporting-MTA not using virtual domains

    I hope this will be an easy answer that I'm just not seeing... I have mail running on 10.5.2 with multiple virtual domains. vdomain1.com vdomain2.com vdomain3.com etc. Receiving mail and sending mail both work fine, except on occasion I get the follo

  • Ship-To not assigned to Sold-To, even though able to create an order

    Hi, We have a peculiar scenario. We have a Sold-To Ex: 1100, ship to 1200 and 1300 for a sales area, ex 1000-10-10. Here only 1200 Ship-to is assigned to Sold to 1100. ( SH 1300 is not assigned to SP 1100). I am able to create an order for 1100 and 1