03-23-2024 05:57 AM
Hi,
In the file below I have a problem that when index is 0, the first row of the column in the array does not take value as it should like the other rows do. As it is shown in the picture, I got (0+0i)!!!.
Solved! Go to Solution.
03-23-2024 07:09 AM
Its because you defined indexes and symbol as 2D arrays with just one column, then when indexing in inner loop you will get "default" values from non-existing elemenths, which are zeroes, this will overwrite elements in 2D array with "unexpected" values.
If I understood your needs correctly, then you have to define both arrays as 1D, then use something like that:
Then result should be OK:
In additional, you don't need to use reshape array to create, kjust use initialize array instead, and don't use doubled for indexes, where you need integers.
03-23-2024 07:10 AM - edited 03-23-2024 07:11 AM
I recommend you learn to use Autoindexing Tunnels. They will simplify your code. When I did that, I had no issues.
It took me way longer to realize what your issue is here than I care to admit. You are indexing out past the input arrays. The default values are therefore being indexed out (0 and 0 + 0i). So your value is being overwritten. Use Autoindexing tunnels to tell the FOR loops how many times to iterate and this issue goes away.
03-23-2024 07:23 AM
@crossrulz wrote:
I recommend you learn to use Autoindexing Tunnels.
Yes, for sure, and this can be used on output as well, then may be simplified like that:
03-23-2024 07:54 AM
Thank you all
03-23-2024 10:39 AM - edited 03-23-2024 10:41 AM
@HUSAM2324 wrote:
Hi,
In the file below I have a problem that when index is 0, the first row of the column in the array does not take value as it should like the other rows do. As it is shown in the picture, I got (0+0i)!!!.
When attaching code, make sure that all controls have some typical default values (e.g. as shown in your picture), especially since you seem to have a 2D array with only one column visible (!!!). (Fill your controls, then edit..."make current values default"). As a bonus, you could also fill indicators with the result you want (instead of what you get), so we can verify if our suggestions are actually correct. It is also not clear why your indices are DBL instead of I32. It is also easier to debug if the values are simple.
Unlike others here, I don't want to reverse engineer your code, especially since it apparently does not work the way you want.
Can we start with a clear description of the problem:
03-23-2024 10:57 AM
Maybe something as follows is what you really want? Wild guess!! (You can change the datatype back to complex, of course).
(And no, "reshape array" is not really the intended tool to "initialize an array" (hint!))