Azzera filtri
Azzera filtri

Duplicating element in table that is stored in cell array

1 visualizzazione (ultimi 30 giorni)
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!

Risposta accettata

Elizabeth
Elizabeth il 27 Gen 2016
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.

Più risposte (0)

Categorie

Scopri di più su Tables in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by