MATLAB: How to ensure that dynamically create symbolically variables are real

realsyms

Hello,
I'm creating symbolic variables dynamically and I wanted to ensure that the symbolic variables are real.
I have the code
clear all
index = {'1'};
List = {'A','B','C'};
A=sym(strcat(List,index))
How can I modify this to make sure that the symbolic variables stored in A are real? I have tried changing to A=sym(strcat(List,index),'real'), but this doesn't work.
I'm looking to do something like
syms A1 B1 C1 real
A = [A1 B1 C1]
except I want to declare the variable names dynamically.
(I can't assume that List will contain alphabetically ordered letters. It is whatever list the user inputs.)
Thank you, Kevin

Best Answer

clear all
index = {'1'};
List = {'A','B','C'};
A=sym(sym(strcat(List,index)),'real')