MATLAB Answers

Why can't I read from a file in Entity Generation's Intergeneration Time Action?

1 view (last 30 days)
Elliott Rachlin
Elliott Rachlin on 24 Oct 2018
The Code:
persistent rngInit;
coder.extrinsic('str2num');
coder.extrinsic('fgetl');
if isempty(rngInit)
SeedfileID = fopen('Seed.txt');
SeedString=fgetl(SeedfileID);
fclose(SeedfileID);
Seed=str2num(SeedString);
Seed=uint16(Seed);
rng(Seed);
rngInit=true;
end
mu = 12;
dt = -mu * log(1-rand());
Problem is that Seed always comes back as 0. The input file contains a single line of text containing "6<newline>" (without the quotes)

  0 Comments

Sign in to comment.

Answers (0)

Sign in to answer this question.


Translated by