Subdivide a cell, based on the number of columns, inside a for loop
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi! I would like to compact the rows 'char2string1', 'char2string2', ... inside a for loop. How could I do this?
char2string = importdata("char2string.mat");
num_char2string = width(char2string);
Col = 6;
Row = num_char2string/Col;
Row = round(Row,0);
% I would like to compact these rows because they have to depend by 'Col' and 'Row'
char2string_1 = char2string(1,1:Col);
char2string_2 = char2string(1,Col+1:Col*2);
char2string_3 = char2string(1,Col*2+1:Col*3);
char2string_4 = char2string(1,Col*3+1:Col*4);
char2string_5 = char2string(1,Col*4+1:end);
댓글 수: 3
Dyuman Joshi
2023년 9월 8일
How did you obtain the data? Did you get it as output from some code? As @Stephen23 mentions above, storing in that manner is not efficient.
And why do you want to generate Dynamically named variables?
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!