[Matlab] How to save the obtained values.

  • Context: MATLAB 
  • Thread starter Thread starter hurryon
  • Start date Start date
  • Tags Tags
    Matlab
Click For Summary
SUMMARY

This discussion focuses on saving random variable values generated during simulations in MATLAB. The user seeks a method to preserve these values to ensure reproducibility of results and figures. The suggested solution involves writing the random values to a file, allowing for future access and analysis. This approach is essential for maintaining consistency in simulations that rely on random data generation.

PREREQUISITES
  • Familiarity with MATLAB programming language
  • Understanding of random number generation in MATLAB
  • Knowledge of file I/O operations in MATLAB
  • Basic concepts of simulation and reproducibility in scientific computing
NEXT STEPS
  • Learn how to use MATLAB's 'save' function for saving variables to .mat files
  • Explore MATLAB's 'fprintf' function for writing data to text files
  • Investigate techniques for setting random seed in MATLAB to ensure reproducibility
  • Research best practices for documenting simulation parameters and results
USEFUL FOR

Researchers, data scientists, and engineers conducting simulations in MATLAB who need to save and reproduce random variable outputs for their analyses.

hurryon
Messages
9
Reaction score
2
Hi, all.

I have performed some simulations in where random variables are used. Through the simulations, I got the final results as well as some figures. Here, I have a question. The obtained results and figures are based on the calculation with randomly created values. If I perform again with the same code, I'll get different results and figures. Thus, I'd like to save the current random values. How to save these ones?

I think that other folks might have similar experiences with me.

Thanks in advance.
 
Physics news on Phys.org

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 4 ·
Replies
4
Views
9K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K