It's funny. Some people seem to gravitate to using dot subscripting, some to braces. They both do "contents of", but I always suggest dot for one at a time, braces for multiple at a time. Nothing to do with your real question, but in this case I'd suggest
names = NYLD1.Properties.VariableNames(29:32); sq_names = ... cu_names = ... NYLD1{:,sq_names} = NYLD1{:,names}.^2; NYLD1{:,cu_names} = NYLD1{:,names}.^3;