Hi guys, assume the following: Cell array mx (100×61), Cell array mn (100×61), Cell array a (100×61).
These cell arrays consists of multiple matrix tables. Matrix table 'a' has 7 columns and matrix table mx/mn have one column. I want to carry out the following calculation between the corresponding matrix tables in the cell array: (a{column7row n}-mn{n})/(mx{n}-mn{n}). n=n+1 which increases after each row.
For that purpose I have been given this formula on the forum: Hi guys, assume the following: Cell array mx (100×61), Cell array mn (100×61), Cell array a (100×61).
These cell arrays consists of multiple matrix tables. Matrix table a has 7 columns and matrix table mx/mn have one column. I want to carry out the following calculation between the corresponding matrix tables in the cell array: (a{column7row n}-mn{n})/(mx{n}-mn{n}). n=n+1 which increases after each row.
For that purpose I have been given this formula on the forum:
q = (a{1}(:,7)-mx{:})./(mx{:}-mn{:});
The formula is great but for that formula to work I had to replicate the numbers in the matrices of the cell array mx and mn with the following formula:
n=61for f = 1:nfor k=1:length(mx) mx{k, f} = [kron(mx{k, f}, ones(60, 1))];endendn=61for f = 1:nfor k=1:length(mn) mn{k, f} = [kron(mn{k, f}, ones(60, 1))];endend
The problem is that this process uses a lot of memory. Is there a short cut to carry out the calculation without first replicating the cells.The replication was necessary as each matrix in the original mn/mk had 60 times less rows than in the matrices of cell array a, i.e. when mn{1,1} had 6000 rows then the corresponding cell in a{1,1} had 360000. So in order to carry out a calculation I had to replicate the rows in mn first. I want the calculation to be carried out with the corresponding replicated rows without replicating the actual rows.
Best Answer