MATLAB: How to create table of unkown number of matrices with same size

table

Hello,
I would like to create table of unknown number of matrices with same sizes, so I can't do it like this:
table1 = table(zeros([5,5]),zeros([5,5]),zeros([5,5]), 'VariableNames', {'matrix1','matrix2','matrix3'});
But here I am stuck because I am not able to find out how to make this without listing zeros([5,5]) n-times, where I don't know what will n be so i had to code it somehow.
Btw, I need to have variable names set as in previous example too, but making string array for it is not a problem 🙂
Thank you 🙂

Best Answer

args=cell(1,n);
args(:)={zeros(5)};
table1 = table(args{:});
Related Question