Index in position 1 is invalid. Array indices must be positive integers or logical values ERROR

2 visualizaciones (últimos 30 días)
hello ,
I try to create a matrix in which every element must have the same column sum of another matrix.
Specifically , i have this matrix :
0.9748 1
0.9748 1
0.5416 0.2996
and i want to create that matrix
0.9748+0.9748+0.5416 1+1+0.2996
0.9748+0.9748+0.5416 1+1+0.2996
0.9748+0.9748+0.5416 1+1+0.2996
i use this command :
second_term_denominator_2(j,i)=second_term_denominator_1(sum(second_term_denominator_1,i),i)
and it gives this error :
Index in position 1 is invalid. Array indices must
be positive integers or logical values.
Error in UNIFAC (line 67)
second_term_denominator_2(j,i)=second_term_denominator_1(sum(second_term_denominator_1,i),i)
I have attached the full folder of the code. I would be very gratefull if anyone could help me

Respuesta aceptada

s mohammad hosien abedy nejad
s mohammad hosien abedy nejad el 2 de Sept. de 2020
hello.
you can use iteration like this
a =[ 0.9748 1;
0.9748 1;
0.5416 0.2996]
[x , y] = size(a);
for(i = 1:x)
for(j = 1:y)
second_term_denominator_2(i,j) = sum(a(:,j));
end
end

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by