Changes between Initial Version and Version 1 of Ticket #2309, comment 9
- Timestamp:
- 2013-08-13T20:40:52Z (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #2309, comment 9
initial v1 2 2 3 3 As to a while-loop, is there a reason to prefer it over a for-loop if we knew that the number of lines in the file is fixed?---But, actually, we are approaching my original intent: i wanted to read in items from a file whose number is not fixed. So i need a while-loop. Therefore i checked a modification of the model above which just replaces the for-loop by a while-loop (and introduces an explicit variable for indexing the lines): 4 4 {{{#!mo 5 5 model ReadArray 6 6 import Streams = Modelica.Utilities.Streams; … … 22 22 end while; 23 23 end ReadArray; 24 24 }}} 25 25 The translation seems to be ok, but, unfortunately, now the executable crashes. 26 26 The second thing i need is an array with an unspecified dimension. I checked it with a model that leaves just the dimension unspecified (and still uses a for-loop): 27 27 {{{#!mo 28 28 model ReadArray 29 29 import Streams = Modelica.Utilities.Streams; … … 43 43 end for; 44 44 end ReadArray; 45 45 }}} 46 46 Here i get: 47 47