Incorporating Structure Fields into a Function as Inputs
이전 댓글 표시
I'm using MATLAB (Mapping Toolbox) to create a large number of lines between different countries. Since there are so many lines, I'm trying to do this using object-oriented programming. This is the method I've written:
function transline = createlines(transline,Name,base.CapTr.val(a,b),base.EtrOut.val(:,a,b,1),base.EtrOut.val(:,b,a,1),base.EtrIn.val(:,a,b,1),base.EtrIn.val(:,b,a,1),... coords(c,2),coords(c,1),coords(d,2),coords(d,1))
where base is a struct and I intend to substitute different values for 'a' and 'b', e.g., base.CapTr.val(3,4) and create new objects.
The problem is I can't include base.CapTr.val(a,b) and the subsequent entries as inputs to the function because MATLAB declares the '.' to be an unexpected operator.
So, can you please tell me how I can add varying values of base.CapTr.val(a,b), etc. as inputs to the function?
I don't know if I've explained my problem properly, but I hope it's clear.
Thank you.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Naming Conventions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!