I'm trying to create a MATLAB script which would auto-create a Simulink model based on a information from an Excel spreadsheet. So far, the creation of the model itself through script is working fine. This Excel might also change in size in the future, so I have opted to use while-loops in model creation to be able to keep the script working even through changes
Problem is, I'd like to name each block that is created in this while-loop based on the names used in this same Excel sheet. So far the model creation part is working, but I'm having trouble figuring out the correct syntax to use to name the blocks individually.
My code looks like this:
number_of_inputs_from_data = 10;
input_position_variable = 50;
while number_of_inputs_from_data >= i,
add_block('simulink/Sources/In1', 'AutoCreatedModel/In1', 'MakeNameUnique', 'on')
set_param (gcb, 'position', [1200 input_position_variable 1220 input_position_variable+20]);
input_position_variable = input_position_variable+50;
This script will create the input blocks in a nice vertical line as it should. However, using the 'MakeNameUnique' will name the block just "In1", "In2", "In3" etc.
How to change my script so that the naming of these Input block would come from the Excel Spredsheet? The name is found in "ExcelSheet.BlockName" column in the spreadsheet.