I am trying to create a function that can create a block table that contain their Handle, FullName, BlockType, Parent by using struct. However each time I get enter a model name, it said
Error in createBlockTable (line 9) tableStruct = struct(get(gcb), 'Handle', get(i), 'FullName');
Here is my code
function blockTable = createBlockTable(modelName) load_system(modelName); getBlock = find_system(modelName, 'FindAll', 'on', 'FollowLinks', 'on', 'LookUnderMasks', 'all', 'Type', 'Block'); blockCell = cell(1,length(getBlock)); for n = 1:length(getBlock) for i = getBlock(n, 1) tableStruct = struct(get(i), 'Name'); end end blockTable = assign(tableStruct, blockCell); end
I am thinking that I mess up at line i = getBlock(:,1), but I do not know how to solve this problem. Thanks
Best Answer