q_dq_data = sim.callScriptFunction("get_q_and_dq",scriptHandle);
it returns cell array with double (64-bit) and single (32-bit) types, therefore, I can't use cell2mat function in matlab. Is there a way to force CoppeliaSim to use one type?data type with calling script in Matlab
data type with calling script in Matlab
i'm trying to get data from CoppeliaSim via calling a script in Matlab using ZeroMQ API. It seems CoppeliaSim mixes different types of data. For example, when I can
Re: data type with calling script in Matlab
You need to ensure that all elements of the cell array are of the same type before using cell2mat. You can convert all elements to either double or single.
You can iterate over the elements of the cell array and convert each element.
e.g.:
You can iterate over the elements of the cell array and convert each element.
e.g.:
Code: Select all
for i = 1:length(q_dq_data)
q_dq_data{i} = double(q_dq_data{i});
end
q_dq_mat = cell2mat(q_dq_data);