Hi all,
I'm having some trouble defining subscripted strings. I want to have a model which will allow me to automatically update the subscript element names through Excel.
To this end, I have changed my existing model to have generic subscript names (first, second etc), and now wish to declare a name variable which will store the strings for each of the elements. This will allow me to use a different input sheet and have the names in the model update automatically.
However I have been unable to define this array, either as a constant type or as a string type, I always receive the 'Expecting Operator' error. Does anyone have any suggestions? I am using Vensim DSS 5.3.
Many thanks
Nick
Subscripted strings/String arrays
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Hi Tony,
Yes, that works fine, however what I'm trying to do is specify an array of strings, e.g:
sub: first, second, third
some string variable[sub] :IS: 'Test1', 'Test2', 'Test3'
There's one thing I found in the Vensim help, under 'String Variables in Graphs and Tables', where the following is listed:
pname[p1] :IS: 'Super Sudser' ~~|
pname[p2] :IS: 'Brass Polish' ~~|
However, I can't find any reference to how the pname array is originally declared. I'm not sure if this is possible, but it would be useful to know that it is impossible so I can look for another work around.
Hope this has made some sense.
Nick
Yes, that works fine, however what I'm trying to do is specify an array of strings, e.g:
sub: first, second, third
some string variable[sub] :IS: 'Test1', 'Test2', 'Test3'
There's one thing I found in the Vensim help, under 'String Variables in Graphs and Tables', where the following is listed:
pname[p1] :IS: 'Super Sudser' ~~|
pname[p2] :IS: 'Brass Polish' ~~|
However, I can't find any reference to how the pname array is originally declared. I'm not sure if this is possible, but it would be useful to know that it is impossible so I can look for another work around.
Hope this has made some sense.
Nick
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
Another small problem I've not been having too much luck with. I have the name[sub] variable working properly, but can't import the strings from Excel. GET XLS DATA and GET XLS CONSTANTS both expect to read numerical values. Is there any way around this?
Many thanks in advance (even if it's just saying it's impossible)
Nick
Many thanks in advance (even if it's just saying it's impossible)
Nick
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Thanks Tony, I had thought of that, but I'm trying to have the model working two ways:
1. From within Excel, which works, since there's no need to change the internal model names from 'first' etc., since all the output goes into the same spreadsheet so you can get the names without having them output from the model.
2. From within Vensim. Currently it can take in the values for the parameters, but the graphs created still have 'first' etc. as the legend names, and I'd like those to come from the spreadsheet instead.
So a .cin file would work, but would have to be generated externally to Vensim. I might use this if there isn't any way to pull the strings directly from Excel, but would turn running the model into a two step process.
Thanks
Nick
1. From within Excel, which works, since there's no need to change the internal model names from 'first' etc., since all the output goes into the same spreadsheet so you can get the names without having them output from the model.
2. From within Vensim. Currently it can take in the values for the parameters, but the graphs created still have 'first' etc. as the legend names, and I'd like those to come from the spreadsheet instead.
So a .cin file would work, but would have to be generated externally to Vensim. I might use this if there isn't any way to pull the strings directly from Excel, but would turn running the model into a two step process.
Thanks
Nick
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm