Duplicating element in table that is stored in cell array

4 次查看(过去 30 天)
Hello,
I have a cell array like this:
d = [1x4 table] [2x4 table] [4x15 table]
I collected the result in the cell array because they have different size, as you can see. However, I need to make them having the same number of row, so I need to duplicate it based on the highest number of row (in this case: 4). So if I have (in table)
B = 2 2 2 2 ; 5 5 5 5
the duplication that I need to have is (in table)
B = 2 2 2 2 ; 2 2 2 2 ; 5 5 5 5; 5 5 5 5
I need to store the result in table because the number exceeds the bit provided by Matlab if I store them in matrix, so it will generate 32767 instead of the correct result.
What I tried to use is kron function. However, it does not work with table.
Can anyone help me with it? I am using matlab r2014b. Thanks a lot!

采纳的回答

Elizabeth
Elizabeth 2016-1-27
I found it. In case people need, I put the algorithm here.
So, what I did are:
1. I check the size difference and identify the duplication should be done.
2. Create a new matrix and convert that into table.
3. Fill the table with the data I need.
I realized that because I work with table, I need to create an empty table.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by