I am currently using the byRow
function to calculate row by row, and it resulted in 'Not allowed to create a matrix with type ANY'.
What may be the reason for this error?
Environment Details:
p
My code:
code = """
// linearTimeTrend(p, 12)
byRow(linearTimeTrend{,4},
transpose(p[1:10,1:10]))
"""
s.run(code)
Error:
Not allowed to create a matrix with type ANY
I had verified matrix slice type:
s.run("transpose(p[1:10,1:10]).xtype()") # Returns FLOATING
And I try to Simplify the function call but still fails:
s.run("byRow(linearTimeTrend{,4}, transpose(p[1:10,1:10]))")
The linearTimeTrend
function returns a tuple, but the byRow function can only return a vector of equal length or a scalar.
According to your code requirements, there is no need to transpose; you can directly iterate over the columns using a loop function for processing.
loop(linearTimeTrend{,4}, p[1:10,1:10])