04-12-2010 03:02 PM
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.
04-12-2010 03:53 PM
04-13-2010 10:19 AM
I used Path data type to pass the variable's name , by converting string to path, however I recived error message 1050!, do I need to convert back Path to string?(please see the attched)
04-13-2010 01:11 PM
04-13-2010 01:55 PM
Thanks for the reply Andy,
My code is able to load the *.mat file but not able to pass a selected variable's name to the Matlab Script , here is an example:
assume in *.mat file , testfile.mat that you sent, there are V-char1, V-char2,V-char3,....., and V-char100, now using a Enum in front panel the user should be able to select one variable name at a time , for example V-char50, and plot it.
in my code "varn" input node is supposed to do this job.
after loading the *.mat file " load(file)" when I typed the variable name directly " plot(V-char50) it works , but if I select " V-char50" from front panel and pass it through "varn" input does not recognize the varaible's name .