Get a string from cell array?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi all,
I have a cell array of the variable names as:
varnames = {'t1', 't2', 't3', 't4'}
I have tried to save the variables using varnames in a loop as
save(variable,varnames(i)) and save(variable,varnames{i})
but both of them give an error "Argument must contain a string".
How can I get a string from the cell array?
Thanks already in advance!
Regards, Maria
I managed to solve this already. It works when the variable is given in quotation marks as 'variable'.
-Maria
댓글 수: 0
채택된 답변
Star Strider
2014년 9월 13일
편집: Star Strider
2014년 9월 13일
The argument itself must be a string:
save('variable','varnames')
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!