Calling X1, X2, X3, so on variables in loop as Xi, where i is 1 to n.
조회 수: 6 (최근 30일)
이전 댓글 표시
Vijesh Kumar Valiyappurakkal
2022년 5월 2일
댓글: Vijesh Kumar Valiyappurakkal
2022년 5월 2일
I have variables x1 to x26 kept in a table. I want to call X1, X2, X3, so on variables in a loop as Xi, where i is 1 to 26. Is that possible?
Further I wish to acess the items from the X1 to X26 matrices as X1(1,1) just as a matrix.
Thank you in advance.
Vijesh
댓글 수: 0
채택된 답변
Image Analyst
2022년 5월 2일
Try this:
% Create sample data
x = rand(4, 1);
t = table(x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x)
% Convert table to an array.
ta = table2array(t);
% Extract all x in row 3
row3 = ta(3, :);
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!