Could anyone help me to get the result for the following code.

1 Ansicht (letzte 30 Tage)
jaah navi
jaah navi am 25 Jun. 2021
Kommentiert: Walter Roberson am 25 Jun. 2021
I am having a cell array B=6x1 cell as
1x1 cell -[1]
1x1 cell-[1]
1x1 cell-[1,2]
1x2 cell-[1] [2]
1x2 cell-[1] [2,3]
1x2 cell-[1,2] [3]
Here, the entire cell array contain 12 values. Based on 12 values I having a matrix A as below:
A=[0.3882 -1
0.9808 - 1
0.6832 -1
0.1033 -2
0.3565 -1
0.4774 -2
0.0767 -1
0.1286 -2
0.3660 -3
0.6500 -1
0.4370 -2
0.6444 -3
In A, the bold number (0.6832 0.1033), (0.1286,0.3660),(0.6500,0.6444) needs to be considered together as they corresponds to [1,2], [2,3], [1,2]
using this B and A i need to compute C which perms log operation.
I tried using for loop for it, but for first cell array it considers all the 12 values in A instead of considering only the first value.
Here is the code
B=6x1 cell array
A[ 0.3882
0.9808
0.6832
0.1033
0.3565
0.4774
0.0767
0.1286
0.3660
0.6500
0.4370
0.6444]
for d=1:length(B)
for e=1:length(B{d})
for u =1:size(A,1)
C
end
end
end
Could anyone please help me how i can compute C by considering the required values in A with respect to B.
  1 Kommentar
Walter Roberson
Walter Roberson am 25 Jun. 2021
If you do not want all 12 to be considered, then your for u loop should not loop to the number of rows in A.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by