Need help with a long while loop

조회 수: 1 (최근 30일)
Miguel Alcol
Miguel Alcol 2023년 2월 22일
댓글: Miguel Alcol 2023년 2월 22일
Hi!
Im currently doing my uni thesis about simulation of photovoltaic installations with Matlab. I have this huge while loop where I have a menu function inside. This loop break when you ONLY choose the last 2 option who put the variable exit=1, and my while is while exit==0.
So, the thing is when i tried to add a .mat archive (50x40 double) the menu closes by pressing any button.
I already have 400 lines of code inside the while, i dont know if this is too heavy for Matlab or what. I dont have any idea of computing tough.
If i delete the line which load the archive -> load('archive'); the problem is solved and my menu reopen when it finishes the chosen option.
Any help is welcome. Thank you!
PD: 100% is not a code error, it has to be a memory problem or something i dont understand yet.

채택된 답변

Walter Roberson
Walter Roberson 2023년 2월 22일
load('archive');
loads every variable in archive.mat overwriting existing variables of the same name. One of the variables you are loading is overwriting the variable you are using to control the loop.
You should assign the result of the load to a variable. The result will be a struct with one field for each variable loaded. Extract the variables you need from the struct.
  댓글 수: 1
Miguel Alcol
Miguel Alcol 2023년 2월 22일
Thanks man, that was the problem.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by