- Index
- » Programming
- » Modelica Language
- » Transpose function
Transpose function
Transpose function
I am having trouble getting the following parameter definition to translate properly:
parameter Real C[4,2] = cat(1, {{0,0}}, transpose({array(B * i for i in 2:4),array(A * B * i for i in 2:4)}));
The error I get is:
Error: Instantiation of array component: C failed because index modification: (C[]= = {{0.0, 0.0}}) is invalid.
Array component: C[] has more dimensions than binding = {{0.0, 0.0}}
Any ideas what could cause that?
Thanks!
- palmer13
- 26 Posts
Re: Transpose function
Your code fragment works fine for me. You would need to post a complete model.
- sjoelund.se
- 1700 Posts
Re: Transpose function
bele wrote:
input Real objects_p_0 = transpose({0,20},{0,10});
error: Wrong type or wrong number of arguments to transpose({0, 20}, {0, 10}).
(in component <NO COMPONENT>).
how can I solve this one?
transpose takes a single 2-dimensional array as input, you're trying to use it with two 1-dimensional arrays instead. You probably meant transpose({{0, 20}, {0, 10}}) (note the outer { }). And you need to declare objects_p_0 as an array too of course.
- perost
- 114 Posts
- Index
- » Programming
- » Modelica Language
- » Transpose function