Error 1050 with matlab script

Hi , i'v built an vi which sampling saving and playing audio files , i've also added matlab script for data analysis.
the script tested in matlab and in matlab works great , when im trying to use it in labview i'm getting an error while the matlab sciprt executing . "Error using griddedInterpolant ....."
i think that the error occures whe trying execute the command : "Sigitp = interp1(clptv, clpsig, tv, 'linear'); "
moreover i cant figure how to read the saved filed when the loop is finished.
I cant figure out what is the problem .
here is the vi : 
i've also included the vi 

Cobmetal wrote:
Im novice to labview , and im learning a lot from NI community , thank you for your suggestion , i will go over it , and try to learn the proper way to implement such tasks in the future.
Thank You.
That's excellent!  I believe that if you truly understand dataflow, you will see why your solution isn't the best one.  ASK QUESTIONS IF YOU DON'T UNDERSTAND SOMETHING.  I put that in bold caps because we are here to help you understand and get better. 
Example:
"According to what I learned about dataflow, I think this part of my solution mentioned above can look like this.  (Upload picture.)  Does that seem right to you?"

Similar Messages

  • Permission Denied Error when calling Matlab script from LabWindows​/CVI

    Hello,
    I am reading in data from a DAQ and am writing it to a .csv file in LabWindows/CVI.  I am then sending this data to Matlab to be filtered.  I would like the filtered data to be accessed by LabWindows/CVI so that I can display it as a strip chart.  I have gotten everything to work except the writing to a file in a Matlab script that is called from LabWindows/CVI.  I am basically using the shipped example in found in the activex demo. (http://zone.ni.com/devzone/cda/epd/p/id/2994). I select the script that I want to run and each time it tries to open a file with write permissions I get a "Permission Denied" error.  This occurs when using fopen() in Matlab.  I have also tried using csvwrite() as well as dlmwrite().  Each one gives me a similar error.  The script currently does not try to do any data processing.  It just opens the file, if it is successful it then prints "hello" and then closes it.  The script works well when it is run in Matlab, just not when it is called in LabWindows/CVI.  Below is the script.  Any thoughts, comments or suggestions are greatly appreciated.  I am also open to using other approaches for sending data between Matlab and LabWindows/CVI.  Thanks in advance!!
    fclose('all');
    [file, errmsg] = fopen('out.txt', 'w');
    if(file<0)
        disp(errmsg)
    else
        fprintf(file, 'hello');
        fclose('all');
    end;
    [file, errmsg] = fopen('out.txt', 'w');
    if(file<0)    
    disp(errmsg)
    else  
     fprintf(file, 'hello');    
    fclose('all');
    end;

    I am using Windows 7.  I am running CVI as an administrator and was able to get rid of the "Permission Denied" error by going into the User Account Controls in windows and changing it to "Never Notify".  However, this did not fix the problem of Matlab not being able to write to a file when the script is run from CVI.  In the Matlab code below, It now gets in to the "else", suggesting that fopen() returns a good file handle.  After getting in to the else statement, it will not actually write to the file, nor does it create it.  However, I can make changes to the plot settings and those appear.  Everything is functional when run from Matlab but when run from CVI, things get screwy with opening the file for writing.  It handles the read well.  It seems like there would have to be some file permission errors but, in the CVI program, I open and write to the file "in.csv".  Any help is greatly appreciated.
    clear;
    fclose('all');
    t = zeros(1000);
    t = csvread('in.csv');
    for i=1:1000
        t(i) = t(i)*4;
    end;
    [file, errmsg] = fopen('out.txt', 'w');
    if(file<0)
        disp(errmsg)
    else
        fprintf(file, 'goodbye');
        for i=1:1000
            %t(i) = t(i)*3;
            fprintf(file, '%f,', t(i));
        end;
        fclose(file);
        plot(t/3, t);
        ylabel('t');
        xlabel('Time (s)');
        title('Is this really working?!?');
    end;
    Thanks,
    Chris

  • 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

  • Error message with a script sending emails to multiple recipients.

    Hi all,
    I am very new with powershell scripting and I want to request your attention and help on this issue.
    I am getting this error message "Send-MailMessage: An invalid character was found in the mail header: ','" given by this script:
    Param (
    [string]$Path = "C:\Temp\",
    [string]$SMTPServer = "smtp.domain1.com",
    [string]$From = "[email protected]",
    [string[]]$To = "[email protected],[email protected]",
    [string]$Subject = "New backup file"
    $SMTPMessage = @{
    To = $To
    From = $From
    Subject = "$Subject at $Path"
    Smtpserver = $SMTPServer
    $File = Get-ChildItem $Path | Where { $_.LastWriteTime -ge [datetime]::Now.AddHours(-6) }
    If ($File)
    { $SMTPBody = "`nThe following files have recently been added/changed:`n`n"
    $File | ForEach { $SMTPBody += "$($_.FullName)`n" }
    Send-MailMessage @SMTPMessage -Body $SMTPBody
    I found the ForEach() approach but when I put it inside I get an infinite loop.
    Many thanks for any suggestions

    [string[]]$To = "[email protected],[email protected]",
    should be
    [string[]]$To = @("[email protected]","[email protected]")

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

  • Error message with Action Script 2.0 file

    Hi,
    I am trying to edit an old flash file that uses Action Script 2.0. I am using CS6 and keep getting the following error message after publishing:
    Scene 1, Layer 'AS', Frame 1, Line 5, Column 29
    1067: Implicit coercion of a value of type int to an unrelated type String.
    Can you suggest any fixes or workarounds? I also have Flash 4.0. Can i downsave the file? If so, how?
    Thanks!

    Thank you. I think that did fix the original two errors. But now upon test of the file, I get some new errors:
    Symbol 'MoneySlider', Layer 'AS', Frame 1, Line 7, Column 3
    1120: Access of undefined property ratio.
    Symbol 'MoneySlider', Layer 'AS', Frame 1, Line 7, Column 20
    1180: Call to a possibly undefined method number.
    Symbol 'MoneySlider', Layer 'AS', Frame 1, Line 7, Column 27
    1120: Access of undefined property _root.
    Symbol 'MoneySlider', Layer 'AS', Frame 1, Line 9, Column 27
    1120: Access of undefined property ratio.
    And on the MoneySlide layer in Actions:
    this.ratio = 0;
    this.loadBar._width = 0;
    this.dragger.ratio.text= "$0";
    dragger.onPress=function(){
              this.startDrag(true,0,0,line._width,0);
              this.onEnterFrame=function(){
                        ratio=Math.round(number(_root.transitBenefitLimit/100)*(this._x/(line._width/10 0)));
                        loadBar._width = Math.round(this._x);
                        dragger.ratio.text= "$"+ratio;
    dragger.onRelease=dragger.onReleaseOutside=stopDrag;

  • Error handling with shell script

    Hi,
    I want to write a .sql file with lots of executable statements. These statements need to run on 100 of schemas per database.
    I want to have error handling mechanism in this file in such a way that whenever I get any ORA- error or SP error, it should stop executing there.
    Please help me.
    Thanks.

    872305 wrote:
    Hi,
    I want to write a .sql file with lots of executable statements. These statements need to run on 100 of schemas per database.
    I want to have error handling mechanism in this file in such a way that whenever I get any ORA- error or SP error, it should stop executing there.
    Please help me.
    Thanks.
    10:47:51 SQL> help whenever sqlerror
    WHENEVER SQLERROR
    Performs the specified action (exits SQL*Plus by default) if a
    SQL command or PL/SQL block generates an error.
    WHENEVER SQLERROR {EXIT [SUCCESS|FAILURE|WARNING|n|variable|:BindVariable]
                        [COMMIT|ROLLBACK] | CONTINUE [COMMIT|ROLLBACK|NONE]}
    10:48:07 SQL>

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

  • Error 1048 Matlab Script depends on string length

    Using: Labview 8.2, Matlab 2007a, Windows XP (AMD X2 4200+ 3GB RAM).
    I'm having an issue with MATLAB script server, Error 1048 failed to get variable from script server.  I've read the forums, but most posts are years old and don't address variable size issues.  I have no problem with these strings inside the MATLAB command window.  I'm somewhat inexperienced with LabView, so maybe this VI could have been simplified.
    I'm writing data files with a tab header, using MATLAB to perform some operations on data (I have a library written to do certain things and can't really spend the time to recode in Labview).  When I try to pass out the new header string, I get error 1048 only when the string length goes above a certain size range.  I have iterations because I want to process hundreds of files in a similar fashion to this VI.
    Header length ~ 1300 chars has always been fine, regardless of number of iterations within the VI.
    Header length ~ 2600 chars presents some errors; not deterministic.
    Header length ~ 5200 chars has many errors; not deterministic.
    Header length ~ 7800 chars has many errors, fails almost all the time.
    Also, timing delay after reading in the file seemed to do nothing to help.  Pausing at the end of the MATLAB script did not seem to help. Clearing MATLAB/restarting LabView did not seem to help.  Is there a way to catch variable-specific errors from the script window?  Notice that the output variable is not cleared when it fails to be obtained from the MATLAB window.  I could wrap the whole thing in a while loop until there are no errors, but that doesn't help when the length is so large none of them succeed.   I can split the string inside matlab, but I'd have to create n strings and then concatenate them outside, which still gives me a lack of scalability.  Is there any better way to handle this kind of non-deterministic error?
    Thanks very much for reading.
    Attachments:
    header6001.txt ‏8 KB
    Matlab Script Server Test1.vi ‏38 KB
    header1001.txt ‏2 KB

    Does NI monitor these forums for bug reports to fix?  Here's a non-scalable hack solution I mentioned earlier, creating n string outputs and concatenating them in Labview.  I've checked this in Matlab using the code below.  I've included the VI if anyone has the same issue and wants it.
    Note that I chose to throw the size error if the string is too large for the n you choose.  I prefer this to trying to check the string output to see if it was truncated.
    hcols = size(hstring,2);
    for k = 1:8
        hvar = strcat('h', sprintf('%d',k));
        if( hcols >  k*1000 & k < 8 )
            hcom = sprintf('%s = ''%s'';', hvar, hstring(1, ((k-1)*1000+1):k*1000 ));
        %if size < k*1000, or we're at the end with leftovers, copy what's left
        elseif( hcols >= (k-1)*1000+1  &  (hcols <= k*1000 | k == 8 ))
            hcom = sprintf('%s = ''%s'';', hvar, hstring(1, ((k-1)*1000+1):end));
        else
            hcom = sprintf('%s = '''';', hvar);
        end  
        eval(hcom);
    end
    %Matlab validation code.  Do not use strcat, as it will chop tabs at the endpoints.
    newh = sprintf('%s%s%s%s%s%s%s%s', h1, h2, h3, h4, h5, h6, h7, h8);
    strcmp(hstring, newh)
    Attachments:
    Matlab Script Server Test2.vi ‏40 KB

  • Array size mismatch error (1047) from matlab to labview

    Hello all,
    I have a very strange situation here and I am hoping someone can come up with some ideas for me...
    I am running labview vi's through a web page, and one of my vi's contains a matlab script with two array inputs, one 2d with a varying length, and the second a 1d array with a fixed set of parameters.
    If I call this report on my local system, web server labview and matlab all running on my laptop. Everything works fine. I receive no errors and the matlab script runs and returns data as expected.
    The problem is I have an Identical setup (as near as I can tell) setup on a server, and I receive a 1047 error, reporting an array size mismatch.
    All the input arrays data sets are identical in the vi at the input into the matlab script. And as best as I can tell all sub VI's and M files are identical. The only difference I can come up with is that one setup is running on a server and the other is not, however other vi's using matlab script (although a simpler configuration (no direct inputs or outputs form matlab, all data transferred in and out via txt files )) run fine in both configurations.
    On both systems I running matlab ver 7 (R14) with a single user license and Labview 7.1.
    any ideas or suggestions would be greatly appreciated. Please let me know if any additional details are needed.
    Thank you in advance,
    Chris

    Hello Matt,
    Yes you were correct upgraded LV to 7.1.1 and everything is running fine now.
    thanks
    NPI_Chris wrote:
    Hello all,
    I have a very strange situation here and I am hoping someone can come up with some ideas for me...
    I am running labview vi's through a web page, and one of my vi's contains a matlab script with two array inputs, one 2d with a varying length, and the second a 1d array with a fixed set of parameters.
    If I call this report on my local system, web server labview and matlab all running on my laptop. Everything works fine. I receive no errors and the matlab script runs and returns data as expected.
    The problem is I have an Identical setup (as near as I can tell) setup on a server, and I receive a 1047 error, reporting an array size mismatch.
    All the input arrays data sets are identical in the vi at the input into the matlab script. And as best as I can tell all sub VI's and M files are identical. The only difference I can come up with is that one setup is running on a server and the other is not, however other vi's using matlab script (although a simpler configuration (no direct inputs or outputs form matlab, all data transferred in and out via txt files )) run fine in both configurations.
    On both systems I running matlab ver 7 (R14) with a single user license and Labview 7.1.
    any ideas or suggestions would be greatly appreciated. Please let me know if any additional details are needed.
    Thank you in advance,
    Chris

  • I'm getting a 1048 error after upgrading MATLAB.

    Hi-
    I'm hoping someone might be able to help me.  I have a VI that I've been using w/ no problems that has several MATLAB script nodes.  Recently, MATLAB was upgraded on this machine from 2006b to 2008a.  When I try to run the VI now, I get a 1048 error when the MATLAB script tries to execute.  (I'm not clearing any variables or giving them the same names as existing MATLAB functions.)  I'm currently running LabVIEW 8.6.  Any ideas?  I've tried just shutting down LabVIEW & restarting w/ no luck.  Thanks in advance!
    Erin

    Hi Erin,
    Usually ActiveX registration issues will cause an error 1047.  But you could try reregistering the ActiveX components.  
    Take a look at the following KB:  Why Do I Get Error 1047 When Trying to Use The MATLAB script node in LabVIEW?
    Let me know if this helps at all.
    Justin Parker
    National Instruments
    Product Support Engineer

  • Labview interaction with MATLAB

    Hi,
    I'm working with Matlab script in labview.
    i have both Matlab6.5 and Matlab7.0 on the PC. 
    i have changed the matscript.dll file as requested to work with Matlab6 or later.
    i need to work with the Matlab7.0 but the Labview is going to the Labview 6.5 always.
    how can i direct Labview to work with the Matlab7.0 (without uninstalling the 6.5)??
    Regards,
    Idan Wexler
    Analog Cells Team
    Texas-Instruments -BC-IL
    e-mail: [email protected]
    Tel: 972-9-970-6743
    Fax: 972-9-970-6430
    Mailing address: 8 Hasadnaot St. 3rd floor, Herzelia 46766, Israel

    Hi Idan,
    perhaps this can help you:
    Please make a backup of your registry before trying this!
    - open regedit
    - go to HKEY_CLASSES_ROOT\Matlab.Application\CLSID and look at the ID provided
    - Cross reference that key to HKEY_CLASSES_ROOT\CLSID and see which executable is getting run
    - Change the CLSID in the first path to reference MATLAB 7.0
    - close regedit
    Regards,
     Andi
    ~~~ Logic is a systematic method of coming to the wrong conclusion with confidence ~~~

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

  • 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

Maybe you are looking for