LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

matlab in labview

Hi,
     Im in the middle of a project and need to put the fuzzy logic code that ive written in matlab into labview. I know that there is a matlab script function in labview. I've looked at some examples of how it works, but am unable to get it to work with the fuzzy logic (.fis) file. Any help would be greatly appreciated.
 
Thank you
Adam
0 Kudos
Message 1 of 10
(3,528 Views)
Have no idea what an .fis file is, but the Matlab script node is like a Matlab command window. You either enter the script right in there or you call a function that's in an external .m file.

What exactly are you having problems with?
0 Kudos
Message 2 of 10
(3,506 Views)

Hi,

  The .fis file is how matlab stores the fuzzy logic information from the matlab fuzzy logic toolbox. The bit that im having trouble with is how do I send the inputs to the matlab window and how do I recieve the output from it.

Thank you

Adam

0 Kudos
Message 3 of 10
(3,499 Views)
The Matlab node works the same way as the formula node in terms of inputs and outputs, so you can refer to the documentation on that. Basically, you right-click on the Matlab node's border and select "Add Input" or "Add Output as you need. Type the name of the variable and then you use that same name in the script inside the node. See attached figure.

One thing you may need to do is to add a "cd" line to the script to specify the directory where the .m file is that has the function you're calling if you're written your own function. Alternatively you can mess around with Matlab's search paths.

Message Edited by smercurio_fc on 02-14-2006 02:50 PM

0 Kudos
Message 4 of 10
(3,488 Views)

Adam,

You might want to check out Matlab's Fuzzy Logic Toolbox Product Description. In that description, it makes mention of two things that may help you. The first is "From Simulink, you can generate C code for use in embedded applications that include fuzzy logic. " C-code can be converted into dlls or compiled and used by Labview. Additionally, the documentation makes mention that "You can also save your FIS in ASCII format for use outside the MATLAB environment. The toolbox suppl..."

Admittedly, I don't know that much about the Matlab's Fuzzy Logic Toolbox, but there might be an easier way to approach the problem. Just a thought.

0 Kudos
Message 5 of 10
(3,476 Views)

Hii, smercurio..

              Can you please provide me some another help in this case, i am somewhat new to use MATLAB in LabVIEW.

             As you suggest that, the cd command should be included in the script, but where it should be included either in the MATLAB script node in LabVIEW? or it should be in the MATLAB command window? and how to call .m file in the LabVIEW, which is already written in the MATLAB work directory? can you please provide me with the simple example of how to call .m file in MATLAB script editor in the LabVIEW?

Please help me.

Thanks in Advance,

Nishant

0 Kudos
Message 6 of 10
(3,385 Views)
If you need to use a "cd" command, just put it in the Matlab command window. Then, you can call the function that resides in that .m file. Sort of like this:



Or, did I misunderstand your question?

Message Edited by smercurio_fc on 04-20-2006 08:48 AM

0 Kudos
Message 7 of 10
(3,383 Views)
Hiii,

     First of all thanks for the prompt reply and i want to ask that this path will lead to the .m file, where that m file is lying in the directoyry... isn't it?
          And what would be the data types of the input nodes,  will it depends on this datatypes in the .m file? And can you also show me that how this file will give the output to the .m file back? so that .m file will build an output.

    Thanks again, you dont have understand  wrong about question.

Thanks,

Nishant
0 Kudos
Message 8 of 10
(3,369 Views)
This discussion has gotten a bit off topic from the original post by Adam, so if you have further questions please start a new thread.

As for your question, yes, the "path" control would lead to the path where the .m file is located. The data types of the input nodes would depend on the data types of the variables in the .m file. When you create an input you then right-click on it and select "Choose Data Type" and set the data type as needed. Output from an .m file would be handled via a return value from a function or just a variable. Right-click on the Matlab node (preferably on the right edge), and select "Add Ouput". give it the name corresponding to a variable and set its data type the same way. There's more information in the LabVIEW documentation.

As I said, if you have further questions please start a new thread, as we're no longer talking about using the Fuzzy Logic Toolkit. Perhaps posting a short version of your .m file would be helpful as well.

-Saverio
0 Kudos
Message 9 of 10
(3,365 Views)
Hiii Saverio,

            Thanks man, ya i ll do that, i ll start a new thread if i want to ask further questions on this, but for now this is enough to me, i ll reply you later, thanks again.

Thanks,
Nishant
0 Kudos
Message 10 of 10
(3,360 Views)