Я хочу сохранить значение Matrix (Matrix - это имя матрицы) в отдельной переменной, чтобы в конце я собрал все матрицы, а затем распечатал их все сразу.мой текущий код печатает значение в каждом цикле, в то время как я хочу получить все значения матриц в последнем цикле.
syms num T1 T2 T3 T4 T3 T6 T7 T8 T9 T10 T5
%Getting data for Robot%
prompt = 'Enter the number of joints in your robot';
X = input(prompt);
num = 0;
while(num<X)
matrix_number = ['t ',num2str(num),'_', num2str(num+1)];
link_twist = ['Enter the value of twist(alpha) for the link number',num2str(num+1),' link e.g 10,80 etc'];
disp(link_twist)
al = input(prompt);
link_length = ['Enter the value of offset(d) for the link number',num2str(num+1),' link e.g 1,2,3,4 etc'];
disp(link_length)
prompt = '';
d = input(prompt);
link_offset = ['Enter the value of link length(a) for the link number',num2str(num+1),' link e.g 1,2,3,4 etc'];
disp(link_offset)
prompt = '';
a = input(prompt);
link_theta = ['Enter the value of theta for the link number ',num2str(num+1),' link e.g T1, T2 etc'];
disp(link_theta)
prompt = '';
theta = input(prompt);
Matrix = [cosd(theta) -sind(theta) 0 a;
sind(theta)*cos(al) cosd(theta)*cosd(al) -sind(al) -sind(al)*d; sind(theta)*sind(al) cosd(theta)*sind(al) cosd(al) cosd(al)*d;
0 0 0 1];
disp(matrix_number)
digits(2)
printed_matrix = vpa(Matrix);
pretty(printed_matrix)
num = num+1;
end