Code calculation output checker
Mostra commenti meno recenti
So i have written some code which used a console command to do a calculation
The issue is that this console command doesnt work everytime. Running the same thing multiple times does produce different results(the console calculation, not the matlab code itself)
list=dir("RRfiles\");
for k = 1:length(list)
command = sprintf('simpson RRfiles/RR%g.in', k);
status = system(command);
end
Here is the trouble section of my code.
What simpson does is it takes in a set of values contained in the RR(X).in files and outputs a RR(X).fid file.
An example of a working .fid file is
SIMP
NP=128
SW=173333
TYPE=FID
DATA
0.499999941 0
0.466421028 0
0.469344476 0
.
.
.
0.270661094 0
END
And an example of a failed one is
SIMP
NP=128
SW=173333
TYPE=FID
DATA
0.499999941 0
1.#QNAN 1.#QNAN
1.#QNAN 1.#QNAN
.
.
.
.
END
What i need help with is writing a for loop that comes after this one that goes in the directory where i store the .fid files (something like c:\matlab\codelocation\fidfilelocation) and checks them all to see if they have worked on not, and if they havnt then it runs the console command again and then checks again afterwards, repeating this cycle till all of them have worked.
I know it is weird that the code doesnt work the same everytime. My current solution is to simply '!simpson RR(X).in' and check if it worked and repeat untill it does.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Software Development Tools in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!