07-03-2009 03:25 AM
Hi.
I'm using Labview 8.6 combined with Matlab between Matlab Script Node and I have some problems. Im using Matlab R2008a. In Matlab i’m using the ident toolbox to identify some processes given a data text archive.
I have a function that depends on another functions that doesn't works fine when it’s called from Matlab Script Node.
I have test the function on Matlab and it shows me the proper results. But when I put it on Labview with Matlab script Node (I’ve also probed to put it on Mathscript node and it doesn’t work either) doesn’t give me the correct values (the same values that I have obtained when I’ve call the function from Matlab).
I think that the problem is in my code, so that I will give you all the functions I’ve used for accomplish my purposes and the used VI.
(I’ve only revised* the functions made by me, and not the rest of them, I suppose that they don’t have characteristics that Matlab don’t give support to )
*that there aren’t any characteristics of Matlab language that Matlab Script Node don’t support. (I read on NI forums that Labview (actually Matlab Script Node) doesn’t use Matlab structures correctly when you put them in the form “variable.field” (using the “.” Operator) and because of this fact, i have modified the syntaxis of all the structures that i put before; moreover: i’ve read that it also doesn’t works fine with arrays of 3D or more ).
To resume, I will be so happy if anybody wants to read my code for searching any incompatibility between certain expressions and Matlab Script Node.
In order to do the work easier, I copy the list of variables returned and arguments that are necessary to send to the main function “AsignacionPolosssVER2”. Moreover, I put it, certain values for the inputs and the CORRECT values of outputs of the function for these certain values, in order to set a reference to distinguish if the VI runs fine or not.
Archives made by me:
-scriptaparte.vi
-saturacion.m
- cal_procesodiscreto.m
- cal_procesocontinuo2VER2.m
- cal_procesocontinuo2VER2.m
NOTE: change the path given to the variables “pa” and “ruta_ar” (in “scriptaparte.vi”) “D:\Documents and Settings\Administrador\Escritorio\scriptnode2\datos7p75.txt” (path + name of data archive) and “D:\Documents and Settings\Administrador\Escritorio\scriptnode2” (path) from the correct ones in your case.
Main function prototype:
function [numreg,denreg,Tmuestreo,status,num_gs,den_gs,delay,numd,dend,bestPer,bestMod,FITf,Modelable,sat]=AsignacionPolossVER2(metodo,espd,ptodis,espe,CancelacionCeros,ruta,FITumbral,n)
Charging certain values:
[numreg,denreg,Tmuestreo,status,num_gs,den_gs,delay,numd,dend,bestPer,bestMod,FITf,Modelable,sat]=AsignacionPolossVER2(0,[0 3 3],[-3 5],1,'s','I:\LabVIEW 8.6\examples\scriptnode2\datos7p75.txt',3,0)
You only have to copy this on Matlab to view the results. However i put it the correct values of outputs for this inputs:
numreg =[309.4818 -305.4845]
denreg =[1.0000 1.5445] Tmuestreo=0.015 status=1
num_gs = 0 -0.3310 0.7064
den_gs = 1.0000 0.2858 0 delay=0.45
numd=-0.0049 0.0050
dend= 1.0000 -1.9957 0.9957
bestPer = 91.2001
bestMod ={'P1IZD';}
FITf =91.2001
Modelable =1
sat =
1 526
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
My opinion: I think that the the program is not well interpreted by Matlab Script Node because when the VI prints all the outputs for all the models (output to the instruction compare(model1,...modeln), the correct (the model which has the best fit -percentage-) model has a different percentage of similarity to the data (in both cases i’m using the same .txt to load the data). Some output variables are right (ie. Tmuestreo).
I give you the folder where i’m working.
Sorry, but my english is not so good.
(If anybody speaks Spanish well, i accept to be replied on this language)
Thanks.
Oscar.
07-03-2009 03:29 AM
07-06-2009 03:46 PM
07-07-2009 04:23 PM
Hi Oscar,
I was not able to execute your m files. It appears that I'm missing the file containing iddata's functional definition. Please attach that file and I will see if I can execute your files.
Thanks,