Convert character vector to evaluable expression
이전 댓글 표시
I have a similar problem to this: Convert cell array of character vectors to evaluable expressions - (mathworks.com)
However, the elements in my cell array are not numerical expressions, but rather variables and struct paths. I tried using sscanf using %f, %d, or %s as formatSpecs. The first 2 returns empty arrays and the latter just returns the original character vector. This is what I am doing.
struct.field1.subfield = 5;
vec = {'struct.field1.subfield'};
sscanf(vec{1},'%s')
I want to get 5.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!