Hi,
I have defined a Custom Data Type like this:
%tDistanceFloat32
tDistanceFloat32 = Simulink.AliasType;tDistanceFloat32.BaseType = 'single';tDistanceFloat32.Description = '[m]';
And a parameter like this:
% NumberOfBalises:
NumberOfBalises = Simulink.Parameter;NumberOfBalises.DataType = 'int32';NumberOfBalises.Value = 9;NumberOfBalises.Description = 'Numero de balizas que hay en el trayecto';
Now, I want to define a vector named 'BalisesPosition' that has 9 elements of type 'tDistanceFloat32', so I have written this:
BalisesPosition = zeros (1,NumberOfBalises.Value);
Till now, this works fine, but the problem comes now. I want to set the values of the vector, wich, as I said before, have to be of type 'tDistanceFloat32', so I type this:
BalisesPosition(1,1) = tDistanceFloat32(0.0);BalisesPosition(1,2) = tDistanceFloat32(1500.0);BalisesPosition(1,3) = tDistanceFloat32(2000.0);...
This gives the following error: '??? Subscript indices must either be real positive integers or logicals.' And if I type the following:
BalisesPosition(1,1) = tDistanceFloat32.BaseType(0.0); BalisesPosition(1,2) = tDistanceFloat32.BaseType(1500.0); BalisesPosition(1,3) = tDistanceFloat32.BaseType(2000.0); ...
It gives this error: '??? Index exceeds matrix dimensions.'
Does anybody know where the problem can be? if I type this:
BalisesPosition(1,1) = single(0.0); BalisesPosition(1,2) = single(1500.0); BalisesPosition(1,3) = single(2000.0); ...
it works, but I donĀ“t want that, I want to use the tDistanceFloat32' type.
Can anybody help me?
Best Answer