Question: Problem with code generation to Matlab

Hi,

I have a problem with code generation to matlab. I have a model in maple that I have sampled for som values and I now want to import these matrices.  The problem is that I want to name the matrises "A(:,:,1)","A(:,:,2)",... i.e. "A(:,:,i)", 3d matrices in matlab.

In CodeGeneration Options it says for the option resultname

"Specifies the name of the result (that is, the generated procedure or the left-hand-side variable in the generated assignment) when the input is unnamed. The value can be any string. When no result name is specified or deduced, an automatically generated name is used."

But when I try to name the matrices as "A(:,:,i)" I just get a warning from CodeGeneration

"Warning, The following variable name replacements were made: ["cg"] = ["A(:,:,1)"]"  and so on.

I can't see what I'm doing wrong.

A1 := Matrix(2, 2, [[1, 2], [3, 4]])

A2 := Matrix(2, 2, [[7, 1], [6, 2]])

A3 := Matrix(2, 2, [[2, 1], [5, 2]])

(CodeGeneration:-Matlab(A || i, resultname = cat("A(:,:,", i, ")")), i = 1 .. 3)

But if I instead name the matrices as

seq(CodeGeneration:-Matlab(A || i, resultname = cat("A", i)), i = 1 .. 3)

there are no problems.

/Daniel

 

 

Please Wait...