help with dynamic rename (and run) of m-file
조회 수: 2 (최근 30일)
이전 댓글 표시
I have two self contained files, one i need to call several times from a script. It is named deck.m and takes the form x=ABC(loads of input arguments). Associated with it is a p-file, ABC.p.
I simply call it in the script as below and things work fine.
script
deck
script
deck
:
Unfortunately the deck name often changes. Is there a dynamic way of renaming (and running) it in the script?
Something like:
name = 'deck' (thinks its a variable!) = deck (attempt to execute script as a function!)
script
name
script
name.
No luck so far :(
댓글 수: 2
Christopher Stapels
2022년 11월 13일
Are you doing this in ThingSpeak? I dont think you can save files in ThingSpeak, so I suspect not. But I see you added the tag "ThingSpeak" to this post
채택된 답변
Walter Roberson
2022년 11월 13일
이동: Walter Roberson
2022년 11월 13일
is deck a script or a function with no parameters?
If it is a script see run()
If it is a function then create a function handle and invoke the handle each time
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!