I ran TWO almost same codes (different file), on TWO opened Matlab at a time, The Result will be the same?

조회 수: 1 (최근 30일)
I was executing a code of soft computing things, which if the same file you run more than once, the result will not always be the same though. So one day I found out that if I ran two same codes (different file and folder, different at one small part) - to compare the difference from that small part -, the results are TOTALLY the same. So will this action always made MATLAB confuses the result obtained?
I hope someone understands what I asked because I myself don't really know how to say it.
  댓글 수: 1
Rik
Rik 2018년 6월 23일
How are we supposed to answer your question without knowing what you did? Have a read here (or here for more general advice) and here. It will greatly improve your chances of getting an answer.

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2018년 6월 23일
It sounds as if your code uses random numbers. By default, the random number generator in different MATLAB sessions is initialized the same. You can use rng() to initialize the seed for the random number generator.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by