Script Matlab In Labview

Buongiorno a tutti,
sono nuovo di questo forum. Sono un tirocinante presso l'università di Napoli Federico II e sto familiarizzando con l'ambiente LabView. Mi è stato assegnato il compito di eseguire uno script Matlab mediante LabView (le macchine su cui lavoro possiedono la versione 7.0 e 8.5). Se mi sapete dare qualche informazione ve ne sarei grato o anche qualche link visto che sto agli inizi.
Saluti.
Sorry for my english...

Sorry, can you move this question to italian community?
Thanks
Sorry for my english...

Similar Messages

  • MATLAB and LabVIEW Communication Optimal Performance

    I have tried my own code,  searched through forums and examples to try and figure out best method to communicate between LabVIEW and MATLAB.  Most of the information I found was over a year old and I was wondering if there was a better current solution.  My goal is to work in LabVIEW to collect the data, process in MATLAB and return the results to LabVIEW.  I have encountered some difficulty in my search and before I delve even further in to one in particular, I was wondering if anybody had an optimal solution with this communication protocol or solutions to my errors encountered thus far.
    I have looked at the following methods.
    1)TCP/IP and a very good example found here: http://www.mathworks.com/matlabcentral/fileexchange/11802-matlab-tcp-ip-code-example
    When I try to adjust even the example and communicate for my own purposes I get the following errors
    Error 63 if MATLAB server not running
    Error 66 occurs if the TCP/IP connection is closed by the peer. In this case, Windows notices that no data is returned within a reasonable time, and it closes the TCP/IP connection. When LabVIEW attempts to communicate after Windows closes the connection, error 66 is the result. 
    However, the example itself works perfectly and does not get these errors
    2)Math Script Node, works but the post below states that MATLAB Node is faster.
    "computing fft of a 1024x1024 matrix ten times (attached code). Result is that Matlab node version takes 0.5s versus 1.6s for Mathscript node version."
     http://forums.ni.com/t5/LabVIEW/Why-are-mathscript-performances-much-below-matlab-s/m-p/2369760/high...
    3) MATLAB Node, which states it uses ActiveX Technology seemingly works well, but loses time for data transfer.
    4) Trying to use the ActiveX functions or if there is other Automation potential.
    5)Other solutions that I have not found that might be better suited.
    Thank you for any help or suggestions in advance. 

    Barp and Mikeporter,
    Thank you for your assistance:
    The reason I need to do the processing in matlab is as you mentioned the processing script is coming from another person who has already developed it in matlab.  I almost have to treat it as a black box.
    The TCP/IP method was interesting is that none of the errors show up when I run the example but if I try to modify it in a new VI I get the errors.
    I have attached a simple program that just has a basic butterworth low pass filter I am trying to confirm if it works in the Matlab node.  I have done other simple codes which work, and this one does not seem the implement  the appropriate filter.  The LabVIEW signal and LabVIEW filter seem to work at the default values (but not if I change sampling rate) for the Simulation of signal, Matlab signal and Matlab filter work, but the Labview signal processed in Matlab is not working...
    Ideally it would be bandpass filtered (0.1-30) at sampling rate of 256 Hz and further processed from there, but I can't even seem to get low pass to work in the matlab to labview communication.
    Any help would be greatly appreciated.  Once I have that working I will have more of an idea of the constraints of the actual processing Matlab Code I will be using.
    Thank you again.
    -cj18
    Attachments:
    labview_matlab_filter.vi ‏70 KB

  • Easiest way to call MATLAB from Labview

    I have a bunch of MATLAB scripts I've developed over the years. I'd
    like to have Labview collect data and pass it off to my MATLAB scripts
    for plotting and analysis as it is streaming in. What is the easiest
    way for me to do this?
    Thanks for your help,
    Matthew Little

    [email protected] (Matthew Little) wrote in message news:<[email protected]>...
    > I have a bunch of MATLAB scripts I've developed over the years. I'd
    > like to have Labview collect data and pass it off to my MATLAB scripts
    > for plotting and analysis as it is streaming in. What is the easiest
    > way for me to do this?
    >
    > Thanks for your help,
    > Matthew Little
    Matthew:
    Have you tried the Matlab script container in the Mathematics->Formula
    function palette? This node allows you to put your scripts into the
    Labview diagram. I haven't tried it myself, but it should work. Good
    luck.
    sm

  • Ejecutar m files de matlab desde labview

    Hola!
    Me gustaría saber cmo es posible ejecutar m-files de matlab desde Labview, es decir llamar desde Labview que se ejecute un m-file ya creado y poder recuperar la información resultante como puede ser un conjunto de matrices. No se si puede hacer directamente con el labview o hace falta alguna toolkit concreta.
    Muchas gracias

    Larson09
    Si tiene el paquete completo o profesional de Labview entonces tiene el script de Matlab ( lo puede encontrar en paleta de funciones>>Análisis>>Matemáticas>>Formula>>Script de Matlab.
    Para que le funcione este script debe tener instalado matlab, y dentro del script puede ejecutar directamente código de Matlab.
    Espero que esto le ayude
    Atentamente
    Belens

  • Adapter un programme matlab sous labview

    Bonjour
    J'aimerais adapter un programme développé sous Matlab à Labview (version 8.2). C'est la première fois que je fais ca et que j'utilise matlab...
    J'aimerais savoir si c'est mieux de tout faire sous labview ou d'utiliser Matlab script node?
    J'ai regardé l'aide de Matlab script node mais j'ai du mal à comprendre comment cela fonctionne... 
    Voici le code en question
    h=amplitude
    time=abcisses
    N=length (time)
    H= [fft(h)  fft(h) fft(h)]
    al= [0: (N/2)-1, -(N/2):-1]
    for f=1:M
         W= exp(-2*pi^2*al.^2./((f-(N/2)-1).^2));
         S(f; : ) = ifft (H(f+N/2):f+(N/2)+N-1 .*  W);
    end
    S(N/2+1,: )=ifft (H(N+1:2*N) .* [1 zeros(1,N-1)]);
    TT = ifft(fftshift(S,1), [],1);
    Quelqu'un peut il m'éclairer?
    Merci 
    Message Edité par Tartarin le 05-27-2010 08:16 AM
    Message Edité par Tartarin le 05-27-2010 08:17 AM
    Message Edité par Tartarin le 05-27-2010 08:24 AM

    Bonjour Tartarin,
    Concernant votre application, il est toujours préférable de n'utiliser que des fonctions propre à LabVIEW.
    Cependant, si vous souhaitez gagner du temps vous avez en effet la possibilité d'utiliser un noeud Matlab pour réaliser votre application.
    Je vous invite à regarder les exemples fournis avec LabVIEW : Aide » Recherche d'exemples » Communication avec des applications externes » Script MATLAB et Xmath. Vous trouverez ainsi un exemple de calcul fractale avec Matlab en utilisant LabVIEW ce qui devrait vous aider dans votre démarche.
    En vous souhaitant une bonne journée.
    Cordialement,

  • Toolkit matlab avec labview

    bonjour à tous et merci d'avance ,
    je cherche un lien(ou bien une idée) pour télecharger le toolkitmatlab compatible avec labview 2011 (sinon 2009).
    l'objectif c'est que je veux transformer un code matlab vers labview.
    merci les ingénieurs du ni et tout les membres de forum.
    amicalement

    Hi khadija,
    You should be able to find the 2011 version of the mathscript-RT toolkit on ni.com/downloads. The download site has recently undergone a lot of changes and the search may not be up to speed yet. A direct link to the 2011 mathscript-RT toolkit is here: http://joule.ni.com/nidu/cds/view/p/id/2558/lang/en. 
    However, it sounds like you are using Matlab toolkits. The mathscript-RT toolkit re-compiles .m code into labview source code. However, the mathscript-RT toolkit will not work with any of the Matlab® toolkits, such as a vision processing toolkit. A list of commands the mathscript node can use is given here. 
    You also might try using the Matlab Script node, which is separate from the Mathscript-RT node, the Matlab Script node uses activex to call into the Matlab runtime engine. It should be able to utilize any toolkits that the mathscript-RT toolkit can't. However, the Matlab Script node will be slower and will require an installation of Matlab on each computer that your application runs on. 
    MATLAB® is a registered trademark of The MathWorks, Inc. Other product and company names listed are trademarks and trade names of their respective companies.
    Jesse Dennis
    Design Engineer
    Erdos Miller

  • Script matlab

    Bonjour,
    j'utilise des scripts Matlab dans un de mes VI et l'erreur 1050 m'est
    renvoyée. Je ne vois pas du tout comment arranger ce probleme. Merci d'avance.

    Hi,
    First, see if the Matlab Script Node is trying to open any files. If so, then make sure that the current Matlab directory is set to the directory where that file is located.
    The error may also occur if there is a disruption in the script server between MATLAB and LabVIEW and the connection was never re-established (possibly by closing MATLAB prematurely). Close both LabVIEW and MATLAB then relaunch them both and run the VI.
    Regards
    DD

  • Connecting JADE &MATLAB with LabVIEW

    I wish to Connect JADE and MATLAB with LabVIEW,. Please provide the relevant documents.  

    For matlab, there is the matlab script node.
    For JADE, you need to be more specific, because there are several programming tools with that name (e.g. here or here).
    You need also define what you mean by "connect". In the most general case you would simply build a dll in the other language and then call it using the call library function node.
    What are you actually trying to do?
    LabVIEW Champion . Do more with less code and in less time .

  • ActiveX can't create object when VB Script called from Labview

    I have an interesting issue that I can't find a solution for. I am using the DIAdem Run Script.VI in Labview to call a script that opens an Outlook object and sends an email. When the script is called via LabView I get this error:
    However, when I manually run the script from the DIAdem script tab it works as expected with no errors.
    This is the code:
    'Begin email send function
    Dim oOutlookApp
    Dim oOutlookMail
    Dim cnByValue : cnByValue = 1
    Dim cnMailItem : cnMailItem = 0
    ' Get Outlook Application Object
    Set oOutlookApp = CreateObject("Outlook.Application")
    ' Create Mail Item
    Set oOutlookMail = oOutlookApp.CreateItem(cnMailItem)
    ' Set Mail Values
    With oOutlookMail
    .To = "[email protected]"
    .Subject = "Report: " & Data.Root.ActiveChannelGroup.Name & " for " & CurrDate
    .Body = "test automatic report emailing with VB Script."
    ' Add Attachement
    Call .Attachments.Add(strLocFileName, cnByValue, 1 )
    ' Send Mail
    Call .Send()
    End With
     (Original code includes Option Explicit and all variables are properly included/declared, I just took the snippet of what's causing the error).
    I have looked at the following threads for info already:
    http://forums.ni.com/t5/DIAdem/Some-errors-when-calling-LabVIEW-VIs-Interactively-from-DIAdem/td-p/2...
    http://forums.ni.com/t5/DIAdem/Active-X-component-cannot-create-object-Diadem-8-1/m-p/71212/highligh...
    -I tried running the script via Windows explorer (per Brad's suggestion) by itself without the DIAdem specific functions and it runs fine.
    http://forums.ni.com/t5/DIAdem/Error-while-runing-diadem-asynchronous-script-from-labview-on/m-p/111...
    -I am not running the scripts asynchronously
    Using Windows 7 (64bit), DIAdem 11.2 and LabView 7.1.1
    Thank you.

    Hey techerdone -
    I'm afraid I personally can't be of much help - I tested your code both from DIAdem and from LabVIEW and each worked without issues in both cases (Outlook closed, Outlook open).  I'm using DIAdem 2011 SP1, LabVIEW 2011, and Outlook 2007...
    Derrick S.
    Product Manager
    NI DIAdem
    National Instruments

  • Difference between the Matlab and LabVIEW Hann (Hanning) functions

    Hi All,
    I'm hoping someone out there can satisfy my curiosity. I have been porting over some code from Matlab to LabVIEW and came accross a difference in the two implementations of the Hann function. Essentially:
    LabVIEW has array length = n
    http://zone.ni.com/reference/en-XX/help/371361J-01​/lvanls/hanning_window/
    Matlab has array length -1 = N.
    http://www.mathworks.co.uk/help/signal/ref/hann.ht​ml
    (where n= N in the two implementations)
    As I'm not very clued up on signal processing I was hoping someone could explain why there is a difference in implementation and why array length was chosen for the LabVIEW implementation. According to wolfram the parameter a is full width at half maximum:
    http://mathworld.wolfram.com/HanningFunction.html
    http://mathworld.wolfram.com/FullWidthatHalfMaximu​m.html
    Is the difference just due to the interpretation of what this value should be?
    I've attached a modified version of the window comparison example to illustrate the diference.
    Thanks,
    Attachments:
    Window Comparison from example.vi ‏32 KB

    ^N wrote:
    LabVIEW has array length = n
    Matlab has array length -1 = N.
    Could part o the confusion be due to the fact that LabVIEW arrays start with index zero and matlab arrays start with index one?
    I'll look at your code later...
    LabVIEW Champion . Do more with less code and in less time .

  • How to implement Non linear Curve fitting (lsqcurvefit of matlab) in Labview

    Hi Labview Team,
    I am looking a way to implement "lsqcurvefit" command of matlab in Labview to do some curve fitting ; basically to  Solve nonlinear curve-fitting (data-fitting) problems in least-squares sense, at present I couldn't find a better way to implement it. Can you please give me some suggestion on this to how to implement this " curve-fitting: on labview.
    Thanks,
    Ankit Gupta

    You did not say you have the mathscript module. Do you? In any case, labview has a rich set of native nonlinear fitting tools. This seems like a better option.
    LabVIEW Champion . Do more with less code and in less time .

  • I can't find the MATLAB script node in labview

    We are using a MAC G4 with OS 9. We also have labview 5.1. I have looked under Mathematic>>Fomula in the tools palette and I cannot find the MATLAB script node.
    Is there an extra download that I need to get this MATLAB script node?

    The HIQ and MATLAB script nodes are only available in the full and professional development systems. If you have one of these versions, these nodes should be under the Mathematics>>Formula palette.
    If you have the base package of LabVIEW, you will not have access to these script nodes. Details about which options are included in which development packages can be found at:
    http://www.ni.com/labview/devchart.htm

  • Matlab script launched from labview

    Hi everyone,
    I need to run a matlab script controlling a network analizer from labview. I use labview to start the movement of the motors in some experiment. Then, once the movement starts, matlab should run a script to perform adquisition and treatment of the data. Could anyone give me some trick of how to launch the matlab script?
    Best

    Here is a link that looks to describe what you are asking
    http://zone.ni.com/reference/en-XX/help/371361J-01/lvhowto/creating_a_matlab_script/
    Hope that helps.

  • Matlab script window in labview 7.0

    In labview 7.0 the matlab window associated with the scripts server is normally hidden and not accessible to the user. In LV 6.x it was and provided a flexible and interactive way of collecting, analyzing and storing data as matlab workspace.
    Is there an alternative way to access the script server and its workspace under LV 7 ?

    The script server window is not hidden on my machine and I am using LV 7 with Matlab R12. I am not sure how to change this setting (or even if it's possible).

  • Calling Matlab from Labview returns a 1047 error - what am I doing wrong

    above

    Does your script work fine in MATLAB? Do you run a VI or an .exe?
    MATLAB must be running, otherwise LabVIEW will be unable to access the MATLAB server. This will cause the 1047 error. Manually start MATLAB, and your program should run without the error.
    The following KnowledgeBase may also be useful in troubleshooting this issue
    LabVIEW 6.x and Earlier Does Not Interface Properly with MATLAB 6.1 or MATLAB 6.5
    Zvezdana S.
    National Instruments

Maybe you are looking for