11-01-2009 04:21 PM
Hello,
I am using matlab node in labview program. It has a cell variable. How can i get this cell variable ( n, 2D arrays) to the output in one shot? without converting them to 2D array internally in matlab node.
i.e i have
data_classwise as a cell variable inside matlab node.
If i use inetrnal looping like,
data_1 = data_classwise{1};
data_2 = data_classwise{2}; and so on...
i can, at the output of matlab node, have 2D variable data_1, data_2 etc.
But since there are too many of such 2D arrays, is there any other better way out?
Thanks..
11-01-2009 08:32 PM
Wouldn't the .Data component give you the actualy data? I.e., mycellvariable.Data.
Or perhaps the cell2mat function?
11-02-2009
01:44 PM
- last edited on
11-01-2025
06:04 PM
by
Content Cleaner
Hello,
You may want to take a look at the supported data types for the Matlab node: http://zone.ni.com/reference/en-XX/help/371361F-01/lvhowto/hiq_and_matlab_data_types/ . If you have a different type, you will have to convert before outputting the data.
-Zach
11-03-2009 12:20 AM
Technically, what you want is not possible. I have worked with (MATLAB inside LabVIEW) for a long time to know that what you want can not be done, unless I do not clearly understand what you want. You can not pass a cell or structure to LabVIEW from MATLAB.
If you right click the variable in the MATLAB node, you will notice that your option are "array, scalar, string etc".
1. You have a cell array in MATLAB workspace, and you want to to be able to extract the contents of this cell into LabVIEW directly, without going though the intermediate step of extracting the contents of the cell into an array in MATLAB.
..... What I do not understand is why you have a problem , of first getting the content of the cell in MATLAB, and passing it into LabVIEW. data_1 = data_classwise{1,n};
Since n can be an input control in LabVIEW, you can always vary the value of n, and get the your array.
Perhaps, if you can attach your VI or a picture file, or at least a better explanation, I can help you write that code.
Or like the previous poster wrote, if all you want is combine the whole content of the cell, then the function cell2mat in MATLAB will do just that, then you can pass that into LabVIEW as an array.
11-03-2009 12:27 AM
thanks ppl for replying.
Actually, i found a way out...i combine all the cells and then split it inside another MATLAB node.
thanks..