The problem is that the model is configured such that root inport is getting one data type, but the external data is using a different data type.
There are two solution routes that depend on what you determine is right for your model.
One route is to change the model to have the same data types as the external data.
The other route is to change the external data to use the same data types as the model wants.
Assuming the former is right for your situation, I've attached files that provide an example similar to this published example, but with non-default data types. This example covers the case of simple signals, not-Buses. The attached script create_data_set_2 creates some typed data
numberOfSamples = endTime * 1/sampleTime +1;
timeVector = (0:numberOfSamples) * sampleTime;
v1 = single( sin(timeVector)*25 );
signal_1 = timeseries(v1, timeVector);
v2 = uint8(randi([0,255],size(timeVector)));
signal_2 = timeseries(v2,timeVector);
nt3 = numerictype(0,8,-fixedExponent);
v3 = fi( nt3.Slope*randi([0,255],size(timeVector)), nt3 );
signal_3 = timeseries(v3,timeVector);
The key next task is to set these data types on the model.
The attached utility getOutDataTypeStrForBlockParam helps get the strings needed to set the data types on the model.
dtstr1 = getOutDataTypeStrForBlockParam(signal_1.Data)
dtstr2 = getOutDataTypeStrForBlockParam(signal_2.Data)
dtstr3 = getOutDataTypeStrForBlockParam(signal_3.Data)
Next, we set the data types on the route inports of the model.
set_param([mdl,'/signal_1'],'OutDataTypeStr',dtstr1)
set_param([mdl,'/signal_2'],'OutDataTypeStr',dtstr2)
set_param([mdl,'/signal_3'],'OutDataTypeStr',dtstr3)
You'll probably need to customize this step for your model.
Note: Setting the data types on your model may cause your model to break due to type incompatibilities inside the model. If that is the case, the simplest approach is to drop in Data Type Conversion blocks after the root inports whose types have changed. Set the output data types of the Conversion blocks to agree with the original data type of the root inports.
After setting the data types on the model to agree with the data types of the external data, you should be able to proceed with Root Inport Mapper.
In summary, to run the attached example,
- get the attached files
- study the script create_data_set_2
- run the script create_data_set_2
- Follow the Root Inport Mapper steps as shown in this published example.
Cheers