reading a workspace value inside a function

5 views (last 30 days)
I used xlsread in a function. now I have another function that uses this function, and that function is used by a script. So xlsread is used 100 of times uselessly and I am getting 'out of memory' error (this maybe is not the main cause of the error). if I take xlsread into the script, the function cannot read the read variable, even it is in the workspace. How do I make the function to use the variable, without making it input variable of the function?
Asliddin Komilov
Asliddin Komilov on 14 Jul 2019
Edited: Asliddin Komilov on 14 Jul 2019
yes its the same file, it would be best if I could do it inside the script and make other functions use it. I am not willing to put it in function input because there are many variables used by different functions. But it is already good without 'persistent':
Elapsed time is 0.077645 seconds.
Elapsed time is 1.035841 seconds.
Elapsed time is 0.005850 seconds.
Elapsed time is 1.412184 seconds.
Elapsed time is 0.000608 seconds.
Elapsed time is 1.529667 seconds.
Elapsed time is 0.001081 seconds.
Elapsed time is 1.416243 seconds.
Elapsed time is 0.000831 seconds.
Elapsed time is 1.475994 seconds.

Sign in to comment.

Accepted Answer

Asliddin Komilov
Asliddin Komilov on 19 Aug 2019
the solution was the momoizefun, look for details above.

More Answers (0)


Find more on Loops and Conditional Statements in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!