How to solve "Dot indexing is not supported for variables of this type...."?

6 views (last 30 days)
Hi,
I wrote a small script to made 4 modules and connection betweeen (pic attached).
I got error message while I tried to connect phisical POS and got "Dot indexing not support for variableof this type".
Can someone help tounderstand whats the problem?
file Matlab script:
open_system('String_arc')
mdl = 'String_arc';
Cube_model = find_system(mdl,'FindAll','on','Name','String_arc');
%%% add basic Module:
for v=1:4 %% loop for 4 Modules
nl=num2str(v);
Add_module(v) = add_block('Mod_26_cells/Module_MC 1', [mdl,'/Module_MC ',nl]);
posc = get(Add_module(v),'Position');
set(Add_module(v),'Position',posc + [100 120*(v-1)-45 100 120*(v-1)-45])
PH_Add_module{v}=get(Add_module(v),'PortHandles');
%%% connect minus to plus ports:
if v>1
add_line(mdl,PH_Add_module{v-1}.LConn(2),PH_Add_module{v}.LConn(1),'Autorouting','on');
end
end
% connect the POS port to first CELL (Cell 1):
Plus_str = find_system(mdl,'LookUnderMasks','All','FindAll','on','Name','POS');
PH_plus2str=get(Plus_str,'PortHandles');
add_line(mdl,Plus_str.RConn,PH_Add_module{1}.LConn(1), 'Autorouting','on');
  4 Comments
Walter Roberson
Walter Roberson on 27 Mar 2025
What happens if
Plus_str = find_system(mdl,'LookUnderMasks','All','FindAll','on','Name','POS');
returns empty because no system named POS was found?
Tommy
Tommy on 27 Mar 2025
Hi,
But POS is PMC_port stick on canvas...a basic slx flie shown on pic above.....

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 27 Mar 2025
Moved: Walter Roberson on 27 Mar 2025
What happens if the command returns empty because no matching lines, ports, or annotations were found?
Option to search for a specific type of model element, specified as one of these:
  • 'block'
  • 'line'
  • 'port'
  • 'annotation'
To find lines, ports, or annotations in the model, you must first specify the value of FindAll as 'on', and then the value of Type.
You did not specify 'type' in your search, so no searching by port would be done.
  20 Comments
Tommy
Tommy on 27 Mar 2025
Edited: Tommy on 27 Mar 2025
connection between POS and NEG PMC_port ....(mark as 1 and 2)

Sign in to comment.

Categories

Find more on Programmatic Model Editing in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!