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

2 views (last 30 days)
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

Accepted Answer

s mohammad hosien abedy nejad
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

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!