This function produces a transpose of any table
smsinks (2021). transposeTable (https://www.mathworks.com/matlabcentral/fileexchange/65743-transposetable), MATLAB Central File Exchange. Retrieved .
Thanks, Julian. I didn't know about rows2vars in R2018b.
I saw MathWorks added rows2vars in R2018b, which does much the same as your function - and suggests you discovered a previously unmet need! I am not rating your submission because I haven't used it myself (I will likely use rows2vars for this purpose).
For interest you might know that the function matlab.lang.makeValidName is probably easier to generate variable names than using regex.
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!