HeiniKlum

20 Reputation

7 Badges

15 years, 140 days

MaplePrimes Activity


These are answers submitted by HeiniKlum

Hi,

 

The question is more than one year old, but maybe the answer is interesting to others as well. One possible way is:

 

Matlab(['j41'=J[1,1],'j42'=J[1,2]]);

 

And so on. The advantage is that you can use a lot more types of expressions if you enclose them in single quotes and Maple does not isue the infamous "Warning, The following variable name replacements were made: ..."

For example:

 

Matlab(t,resultname="t(1)");       # Does not work

Matlab(['t(1)'=t]);                         # Works

 

Another option is to generate the Matlab-code using sequencies:

J:=Matrix(2,6);
seq(seq(Matlab(J[i,j], resultname = cat(VarName, convert(i, string),convert(j, string))), j = 1 .. Dimension(J)[2]),i=1 .. Dimension(J)[1]);

Here the output name is constructed by concatenation of strings.

Page 1 of 1