04-11-2021 08:51 AM
配列の最大最小を使って,2次元配列の各列ごとの最大値を求めたいと思っています。ヘルプによると,2次元配列の場合は,出力が1次元配列になるはずですが,スカラーになってしまいます。結果は配列全体の中から最大値が出力されてしまいます。どうしたら,配列で最大値が出力できるでしょうか?
https://zone.ni.com/reference/ja-XX/help/371361R-0112/glang/array_max_and_min/#details
Solved! Go to Solution.
04-11-2021 09:23 AM
Use Index Array in a loop to index each column and call Array Max & Min:
04-11-2021 10:09 AM
Hi Lucian
Thank you very much for your comment! I tried your method and worked fine. I misunderstood the help document. If we input 2d array, the function outputs 1d array of index not 1d array of maximum value.
04-11-2021 10:24 AM
This vi returns max and min values of each column of 2d array as 1d array.
04-11-2021 11:32 AM - edited 04-11-2021 11:32 AM
Hi Yutaka,
this will do the same as your VI:
No need to use "matrix" functions when you want to handle simple (2D) arrays! (Matrix functions should only be used for linear algebra problems!)
No need to check the array size when you use autoindexing FOR loops…