Using matlab script block

Hello!
I'm using a matlab script block and I have a problem that i don't how to solve it,
I want to import a column that in matlab is cell array or char array type. When you create an output in matlab script block you have to specify the data type....I choose string, but with this option you can only import one string....and I want to import a whole column.
Someone knows how I have to do to import this data type? I have to do some changes to the data from matlab or I have to use some especific block in labview to adapt the data.
Please help me!!
 Thanks!!!

Ooooppss!
My computer is crazy....sorry.
I'm near to solve my problem...
The problem is that I have a column of strings like this
str=['labview'
        'labview2'
       'labview3'
        'labview4']
I use the double command but the byte array to string block only converts me an element, do you know is exist another block to change all the elements.
I've tried to do with a for loop block....using an index array and changing with i the index element, but it doen'st work.
You have some idea?

Similar Messages

  • Open a file using matlab script block

    Hello!
    I want to open a file from a specified directory using matlab script block.
    The input of this block is a string with file's name......but it doesn't work in this way. I have to change the input data or I have to change it  into matlab matlab script?
    Some idea?
    Thanks!
    Attachments:
    example.PNG ‏4 KB

    Ooooppss!
    My computer is crazy....sorry.
    I'm near to solve my problem...
    The problem is that I have a column of strings like this
    str=['labview'
            'labview2'
           'labview3'
            'labview4']
    I use the double command but the byte array to string block only converts me an element, do you know is exist another block to change all the elements.
    I've tried to do with a for loop block....using an index array and changing with i the index element, but it doen'st work.
    You have some idea?

  • Using matlab script

    Hello!
    I'm using matlab script block in my aplication. The m-file (from matlab) contain an 'if' that depends of an input of labview.
    I want to pass trough this condition only once when input's value changes, but labview "covert" this 'if' in a 'while' and pass trough this sequence n times.
    How can I to impose to pass throug the sequence once the input's value change. It's better to specifie it from matab or from labview.
    Thank you in adavance 

    What is surrounding the matlab script block? LabVIEW should be modifying the matlab code, it should be connecting with matlab and matlab executes its code, returning the results to LabVIEW. Can you do a screen capture of the part of the code that contains the matlab stuff? If yes make sure that it is saved as a .jpg (not .bmp!) for size reasons. If not, if you can send the part of your code that includes the matlab stuff that would help.
    P.M.
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • Using a 3D matrix with a matlab script block

    Hi all of you,
    it is possible to input a 3D matrix (e.g. 10x4x20) to a matlab script block or you have to unfold this data in a 2D array?
    Do you know what i have to do to input directly a 3D array (array of real numbers) to a matlab script block.
    P.D.; I'm using labview 7.0 and matlab 6.5
    Thank you very much
    Larson

    Hi,
    as far as I know there is only the possibility to have an input for a
    2D array to matlab scriptnode. Thus you should convert your 3D data to
    2D in LV and reconvert it in your matlab code into 3D.
    When you select 3D data as an output of a script node it automatically
    appears as 2D (but no data will be lost). So when you have to use it in
    LV again as 3D data, what you have to do is reconvert it back from 2D
    to 3D.
    Hope this helps!

  • 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

  • Sending time and voltage samples as input to matlab script block

    Hello,
    I am planning to use Matlab script in labview and the matlab scritp block needs inputs of time and voltage values of sampled signal to post process.
    Can someone explain me of how to send the sampled values of time and volatge after every  'x' interval of time to the matlab scritp block I mean if the sampling rate is 100Hz then 100samples will be collected in 1 sec but I want to send both time and votlage values collected after every 10 seconds to the matlab scritp block.
    Thanks.

    Hi,
    I am using DAQUnit 6016 that samples an analog signal of sensor.The vi I tried is attached below.
    Attachments:
    Labview&Matlab.vi ‏55 KB

  • How to load a variable using MATLAB Script?

    I need to load a selected variable from .mat file, using MATLAB script , and analyse it.
    the attched shows my vi, there are two inputs nodes 'file' contains the .mat file path, and 'varn' contains varibale name in that .mat file which can be selected by user. Using " load(file)" the whole .mat file is loaded in the workspace and become avaiable at output node, however I am not able to pass a selected variable name through string "varn" input, MATLAB script does not recognize the variable.
    any idea to reslove it is realy appreciated.
    Attachments:
    load a variable.JPG ‏18 KB

    Download the VI and .MAT file. Run the VI, and it'll plot the data inside of the .MAT file.
    Andy Chang
    National Instruments
    LabVIEW Control Design and Simulation
    Attachments:
    testfile.zip ‏5 KB

  • How to do complex engineering calculation in labview.I tried using MATLAB script

    Hello,
    I am trying to use matlab script node to solve two complex equation.But i get different  errors everytime i run my program.sometimes 1048 sometimes 1050 and sometimes it says LABVIEW could not extract variable from Matlab.I am attaching  my MATLAB script node with this thread.Please Help me out to get rid of this problem.
    I am  using LV-8 and MATLAB R-2006a.
    Attachments:
    matlab.vi ‏10 KB

    Hi Praween,
    beside my little MatLab knowledge I tried to replace your formula with equivalent LV code...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    matlab_lv80.vi ‏18 KB

  • Error (1046) using matlab script

    Hi ,
    im trying to use matlab script Labview , i've got matlab installed.
    when im running the VI , i'm getting an error 1046 , i tried to search the community ,
    and i've been told to check the "choose script server" , i dont know why , but i it's "grayed" ,
    and i cant change anything.

    Cobmetal,
    Looking at the following KnowledgeBase, it looks like MATLAB® may need to be registered as an ActiveX server first.
    http://digital.ni.com/public.nsf/allkb/5BECAA32D63921628625670C005BDA1A?OpenDocument
    Mathworks has good documentation about how to register MATLAB as a COM Automation server in the Windows registry when launched. I would try to do that if the option to choose script server is greyed out (Ctrl+F regserver).
    http://www.mathworks.com/help/matlab/ref/matlabwindows.html
    MATLAB® is a registered trademark of The MathWorks, Inc. Other product and company names listed are trademarks and trade names of their respective companies.
    Matt J
    Professional Googler and Kudo Addict
    National Instruments

  • "Object Required" error when using the script block from the code behind

    I try to use the following script block on the code behind page
    <script defer='true' id='NavID' type='text/javascript'>Nav();</script>
    and the function Nav() is on the .aspx page. It gives me the "Object Required" error message. BUT if I add an alert("hello!!!") line inside of the Nav() function, it works fine after the user closes the alert box. Has anyone experienced a similar problem? Please help. Thanks.

    There is no way to troubleshoot this by looking at a picture of the diagram. LabVIEW 6 is almost prehistory and many things have changed, especially the file IO all looks different so it is impossible to tell what you are doing.
    Error 7 is file not found, so most likely your string operations are not correct. What are the full strings? What is the final file name (maybe you are missing a "\" or maybe you are on a different OS type). Put an indicator at the path wire to see what's happening!
    Is this a datalog file?
    (Overall, the code is a bit suspect. Nobody needs a seven frame flat sequence. ) Why do a control and an indicator have the same label?)
    LabVIEW Champion . Do more with less code and in less time .

  • Creating a random noise (Gaussian) using Matlab Script

    Hello,
    Since I only have Labview 6.1 base, I can't use the white-noise generator in Labview. I'm thinking of using the Matlab Script. I have Matlab 2006R installed in the same computer. However, I tried running the program and nothing happened (I used the help example "a=rand(50);surf(a)" in the Matlab Script.
    Why it's not calling the Matlab, or is there a better way to create a Gaussian distribution in Labview 6.1 Base?
    Thanks a lot!

    Hello,
    Why are you unable to use the Gaussian White Noise VI in LabVIEW 6.1?  It is under the Analyze >> Signal Processing >> Signal Generation palette.  I have attached a simple VI that illustrates creating a matrix.
    If you wish to use the MATLAB® script node, let's first make sure it is working correctly.  Try opening one of the LabVIEW shipping examples.  Browse to <LabVIEW>\examples\scriptnode and open "HiQMATLAB_Fractal.llb."  Then open "MATLAB Fractal.vi."  Run the VI.  Do you get any error windows that pop up?  If not and you see a picture of a fractal appear, then the connection to the MATLAB software is working correctly.  In your VI, try creating an error out indicator from the MATLAB script node and see if any errors appear.
    If you do see an error in the shipping example, it means there is a problem with the software connection.  Make sure that you have launched the MATLAB software at least once after you installed it.  This will set up the necessary connection information.  Then launch LabVIEW.  If this isn't the issue, we could try manually restoring the server commands.  Make sure LabVIEW and the MATLAB software are not running.  Go to a command prompt, browse to the MATLAB bin directory (e.g. MATLAB\R2006b\bin), and type
    matlab -regserver
    Quit the instance of the MATLAB software that appears and launch LabVIEW.  If this also fails, please post again with any error information you receive.
    Also, the rand function in your script will not generate a Gaussian distribution. You will need to use the randn function instead.
    MATLAB® is a registered trademark of The MathWorks, Inc.
    Grant M.
    Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
    Edit: For some reason, I am unable to attach the VI.  I have included a picture instead.
    Message Edited by GrantM on 08-08-2008 02:50 PM
    Attachments:
    Gaussian Matrix.png ‏35 KB

  • Possible threadsafe issues using Matlab scripts?

    Hi all,
    I'm developing an application in Labview 6.1 that makes extensive use
    of Matlab scripts.  The application executes the same set of
    scripts for multiple data sources, and keeps track of the inputs and
    outputs for each data source separately.  I've been noticing that
    the application produces the correct results when running only one data
    source, but that the results are often incorrect when I run it against
    multiple data sources.
    I've done some investigation, and have found that all Matlab scripts
    share a common memory workspace in Matlab.  That is to say that if
    I have ScriptA that takes variable X as an input, and ScriptB that does
    not, ScriptB nonetheless has access to variable X in its workspace
    (from the last time ScriptA was called).  This doesn't pose a
    problem to me directly, but it has made me wonder if there are
    potential threading issues in the scripts.
    Consider the following scenario with one script and two data
    sources.  I'm wondering if this scenario is possible in Labview:
    1.  Thread1 calls ScriptA, passing data from SourceX.
    2.  During Matlab execution (somewhere in the middle), Thread1 is suspended.
    3.  Thread2 calls ScriptA, passing data from SourceY (data have the same variable names, since it's the same script).
    4.  Thread2 finishes ScriptA execution uninterrupted with SourceY data.
    5.  Thread1 is reactivated, but now the Matlab workspace data has
    been replaced with SourceY.  So, Thread1 started with SourceX
    data, but finished with SourceY data.
    6.  An incorrect result for Thread1 is produced, because the wrong data was processed.
    Clearly I could get around this problem with a semaphore, but first I'd
    like to know if this scenario can even happen.  Are Matlab scripts
    treated as atomic operations in Labview, or can the threads be
    suspended midway through execution?
    Thanks for your help!
    cjb

    Hello,
    No. LabVIEW will definitely not compile a VI while it's running - I think that would be, even conceptually, impossible.  In fact, some properties (accessed via property nodes) are not editable at run-time for basically that reason, that a recompile would be necessary in order for the affect to take place, and the recompile can't take place at run-time!
    It is indeed strange behavior, particularly because it is intermittent (which does hint at a threading issue, or some factor outside the development environment).  Can you try moving the initialization to LabVIEW?  I have attached an example of a so-called functional global variable (a simple code module in this case).  It has two "states" (which are cases) - one is initialize and the other is the "usually executing case."  The initialize case is used to initialize the shift register to an array of 50 doubles, where the other case will compute the running average, min, and max across the 50 most recent random numbers generated.  The 50 data point code module.vi is the code module, and it is called by Use 50 data point code module.vi.  When you run Use 50 data point code module.vi, be sure to toggle the initialize boolean so that the initialize case executes once to allocate and initialize an array with 50 elements; when you toggle it back then it will execute the other case on each iteration, and begin computing the statistics noted by keeping an array with the 50 most recent random data points generated.
    I hope this helps and that you are able to incorporate a similar code module into your application to avoid the intermittent errant behavior!
    Best Regards, and feel free to post again with updates!
    JLS
    Best,
    JLS
    Sixclear
    Attachments:
    Use 50 data point code module.zip ‏27 KB

  • Compiler Error with simple vi using MatLab script nodes

    While attempting to build a simple vi to test the capabilities of LabView's interface with MatLab, I received a compiler error message that said I should report the problem to National Instruments Tech Support. The error said, "reference to undefined label from: refPC=0x41C." I've attached the vi that created the error. I am using LabView 7.0 on a PC running Windows 98.
    Attachments:
    Compliererror.vi ‏11 KB

    I don't know if this will help your problem, but there is a fix for some problems with LabVIEW 7.0 and Matlab:
    http://digital.ni.com/public.nsf/websearch/4475BC3CEB062C9586256D750058F14B?OpenDocument
    Good luck,
    -Jim

  • How to insert data from file into matlab script node

    I have interfaced input data from file to be processed using matlab script node. But the problem is that I could not capture the multiple data into matlab script node and to convert it into matrix. Further to this I need to process the data by plotting graphs from it. Thank you in advance for the advice

    Zarina,
    To clarify your problem, you have a script node contaning your Matlab code. Are you then using the standard LV functions to load in your data from a file and pass it into the script node?
    Regards
    Tristan

  • Same code gives different results in Matlab Script in Labview and Matlab

    I am implemeting a Matlab code into a LabVIEW application using Matlab script. When I import the exactly same code to the Matlab Script in LabVIEW it gives a different result than it is in Matlab. This code is a simulation code including first kind bessel functions. Using LabVIEW 7.1 and Matlab R14 service pack 3.

    Labview 8.5
    Matlab R2009b
    Attached are the graphs produced by matlab script in labview and in matlab.
    The minimum of graph produced by matlab code is below 1 and that in labview is above 1.
    Thanks a lot for your reply.
    Sorry, I haven't quantified the "sometimes" yet. 
    Attachments:
    matlabsResult.jpg ‏29 KB
    LV.png ‏84 KB

Maybe you are looking for

  • Photos don't display on book pages after upgrading to 9.4.2

    I have several books I created in version 9.4.1. After upgrading to iPhoto 9.4.2, most of the pictures will not display on the book pages. Only 1 photo displays out of 3 or 4 photos on the page. Is there a setting that has changed? Using Mountain Lio

  • Sending non-English parameters vlaues to rwservlet for a pdf reports

    Hi friends, I have developed a report which I open through calling rwservlet from an HTML form posting all form inputs to the rwservlet to use as parameters to my report. The problem arises when I try to pass non-English (Arabic) values, the report c

  • How to implement the File Browser Window in Webdynpro

    Hello, The Scenario is as follows. I need to read a file. If the file does the exists then the user should be prompted with a file browser window to choose the location of the file. Please can you let me know how this can be implemented. Regards, Vai

  • Print Shop for Mac 2.0 Will it run on intels

    Hi will The Print Shop for Mac 2.0 by MacKiev work on the new MBP. I am thinking about buying one soon!

  • Upgraded to IOS6 and streaming meye stopped working

    I have cameras at my business using meye. It is now failing to connect since I upgraded software. IS there anyone that may know why the upgraded operating system would prevent me from watching my surveillance cameras? Any ideas or help would be appre