How to create a number of output tables at each iteration ?
1 回表示 (過去 30 日間)
古いコメントを表示
Dear altruists,
Seek suggestion.
I have a "TW" table where TW(:,1) = start row number and TW(:,2) = end row number is mentioned.
I have a "D" table where raw data is present. D is a table which has 1 to 15,000 rows and 10 cols. For each iteration, I have to pick values from "D" table ( copy) with specified rows & cols. and drop it to an output table (paste them) and the requirement is that the output data table name will be change from Z1.........Z20.
I want to output various table for every iteration.
For example,
i =1 will create output table Z1 = D(rows, cols)
i = 2 will create output table Z2 = D(rows, cols)
.
.
i =20 will create output table Z20 = D(rows, cols)
**************************************************************************
for i = 1 : 20
cols = [1 2 5 7];
rows = TW(i,1):(TW(i,2));
Z = D(rows,cols);
end
5 件のコメント
回答 (1 件)
Abhishek Chakram
2023 年 10 月 3 日
Hi MD Rabiul Islam.
It is my understanding that you are facing difficulty to extract multiple rows and columns from a bigger table and store it in multiple named variables. As a workaround, you can create a cell array to achieve a similar result. Here is an example for the same:
Z={};
for i = 1 : 20
cols = [1 2 5 7];
rows = TW(i,1):(TW(i,2));
Z{i} = D(rows,cols);
end
In this example, "Z" is a cell array. You can access each sub table using indexing as shown below:
Z{1}
Z{2}
You can refer to the following documentation to know more about the functions used:
Best Regards,
Abhishek Chakram
1 件のコメント
Stephen23
2023 年 10 月 3 日
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!