SelectConnection.m 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. function [Type, Name, Column] = SelectConnection(tag, map)
  2. %GET_CONNECTION 读取信号连接信息
  3. % type为信号连接类型:
  4. % 's'-连接至软件注入点
  5. % 'p'-连接至物理注入点
  6. % 'v'-连接至变量
  7. % 'a'-连接至数组
  8. % 'n'-无效连接
  9. Type = 'n';
  10. Name = '';
  11. Column = 0;
  12. for i = 1:length(map)
  13. if strcmp(tag, map(i).from)
  14. if isa(map(i).to, 'char')
  15. Type = 'v';
  16. Name = map(i).to;
  17. elseif isa(map(i).to, 'struct')
  18. if strcmp(map(i).to.type, 'port')
  19. if strcmp(map(i).to.spec, 'software')
  20. Type = 's';
  21. Name = map(i).to.channel;
  22. elseif strcmp(map(i).to.spec, 'physical')
  23. Type = 'p';
  24. Name = map(i).to.channel;
  25. end
  26. elseif strcmp(map(i).to.type, "array")
  27. Type = 'a';
  28. Name = map(i).to.name;
  29. Column = map(i).to.column;
  30. end
  31. end
  32. break;
  33. end
  34. end