Creating variable from string
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello, looks like this question has been asked many times but I didn't find any answer. So I'm creating a function which read a text file and runs commands accordingly to what available in the text file. However, there are times when certain variables from the text file are not available within the function but are available in the base workspace (Like different config files for one instrument, and I don't want to reconnect every time). I'm trying to figure out something like this:
function MyFunction('a',b)
if(~exist('a','var')
<Make a variable named 'a' with value of 'b'>
end
댓글 수: 0
채택된 답변
Star Strider
2018년 6월 29일
This is generally not recommended. However it is the only way I am aware of to do what you want.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!