フィルターのクリア

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

2 ビュー (過去 30 日間)
Elliott Rachlin
Elliott Rachlin 2018 年 10 月 24 日
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 件)

カテゴリ

Help Center および File ExchangeDiscrete-Event Simulation についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by