01-21-2025 11:42 AM
I only need to get the output to show an off diagonal elements like this,
formula to get off diagonal:
nbr=3
Here is what I did.
a 3 by 3 output by using the 1d array and zeros (3by3)
To be fair i am not sure what i was doing here because i was just trying out everything and could not understand. Hopefully, someone can help me. I have attached the file.
01-21-2025 11:51 AM - edited 01-21-2025 12:05 PM
@Rusyaidi_arif_cute wrote:
I only need to get the output to show an off diagonal elements like this,
formula to get off diagonal:
nbr=3
I don't understand your formula, because 2D arrays have two indices, not just one (k).
You have two array constants, which one would you like to process?
Your 2D arrays are not square, so the concept of "diagonal" is poorly defined.
Given the default input, what would be the correct result?
Why would you need to spin that loop millions of times per second doing the same thing over and over?
Are you aware that index array is resizable? Compare these two fragments:
01-21-2025 12:18 PM
For starters, I did know it was resizable but didn’t know the function for it. Im surprised it could get much more simpler and less blocks than before!
The while loop all over it was just me trying to understand what it does to everything. Forgot to remove it.
The constant k in that formula refers to a number in the specified row,column vector for example Y(1,2) would represent an element of row 1 and column 1
Y=[Y(1,1) Y(1,2) Y(1,3)
Y(2,1) Y(2,2) Y(2,3)
Y(3,1) Y(3,2) Y(3,3)]
I want to make the diagonal part to be 0.
I cant seem to understand how to.
1d Array is my input Y(k)
whereas Y(zeros) are just Y (3by3) with all zeros in it.
sorry for bad english.
01-21-2025 12:30 PM
01-21-2025 07:11 PM
Yes thats how i want to create thank you so much! I will try to do it with my input.
01-21-2025 07:35 PM
That's one of the objective done, another thing is how would I do it if for example in your case,
(4 by 4) array were added with a 1d array
1d array:- [1
2
3
4]
To make it simpler my formula takes an element from each row of 1d array for example the first row =1, and then
it will add with an element inside (4by4) array, in row 1, col 2 ,vice versa so it would be Y(1,2) & Y(2,1) of the array. The second row of 1d array=2, will add onto another element of Y(2,3)& Y(3,2) and so on.