Explanation

The indicated statement creates a numel(<arg>) by numel(<arg>) array. This is not a common use case and can lead to more memory usage than intended.


Suggested Action

Rewrite the code to generate an array of data of the intended size and shape. For example, if the original call is ones(numel(x)), write:

  1. ones(numel(x), 1) to create a vector of ones with the same number of elements as x.

  2. ones(size(x)) to create an array of ones that is the same size as x.

  3. ones(numel(x), numel(x)) to create an array of ones that is numel(x) by numel(x).