Group Abstract Group Abstract

Message Boards Message Boards

0
|
11.5K Views
|
6 Replies
|
1 Total Like
View groups...
Share
Share this post:

Resize arrays with WSMLink?

I'm trying to run my model with WSMLink, but I want to change the number of elements in my arrays before running. When I change the parameter corresponding to the length of the array, and then try to set the elements of this new array, I get an error saying that the new indices aren't parameter. Ok, I understand why, but how do I resize the arrays first?

e.g.

My array length was 4 now...

WSMSimulate["myPackage.myModel",WSMParameterValues->{arrayLength -> 5, param1[5]->2.0}]

And I get an error. Can I use WSMModelData or WSMCreateModel to change the length of the arrays before trying to set them?

POSTED BY: Eric Smith
6 Replies

Here is the "junk" model if it helps

Attachments:
POSTED BY: Neil Singer
POSTED BY: Neil Singer
POSTED BY: Eric Smith
POSTED BY: Malte Lenz
POSTED BY: Eric Smith

DotName has a few benefits compared to pure strings:

  • It is guaranteed to handle all names correctly.

For a name like my.'name.with'.quotes, working with StringJoin and StringSplit on "." would be incorrect.

  • It makes pattern matching possible, without resorting to string matching/regular expressions

That said, you can do ToString on a DotName to get the .-separated string.

I can't reproduce the red highlight with more than three arguments. That might be a bug in a particular prerelease. If you still see it in the released version, please report it to support and we will have another look.

POSTED BY: Malte Lenz
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard