I have the following problem: I have two arrays called Variable_1 and Variable_2 (same size 8x3, only different values). I need to make calculations with the values inside the array and store the result in a new array. The calculation is the same for both arrays.
Right now, I solved it with 2 for-loops.
for i = 1:size(Variable_1,1)
Calculation_1 = 5 * Variable_1(i,1);
Result_1(i,:) = Calculation_1;
end
for i = 1:size(Variable_2,1)
Calculation_2 = 5 * Variable_2(i,1);
Result_2(i,:) = Calculation_2;
end
I want to get rid of two separate for-loops and do it with one loop or a loop in a loop. The name "Variable_x" needs to be kinda dynamical. It is different for every run in the outer for-loop. First, it is Variable_1 and matlab has to look in the array "Variable_1" at position i. Later, it is Variable_2 and it has to look in another array, here called "Variable_2".
I know that I shouldn't use dynamic variables and however I didn't found a solution anyway. Maybe it works with Cellarrays but I dont't know exactly how I use them in this specific case.
It is kinda hard to explain, so feel free to ask questions if you have one. I am really looking forward for any suggestions.