Writing text from a pre-existing notpade?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Mahmoud Khadijeh
il 24 Mag 2021
Commentato: Image Analyst
il 30 Mag 2021
Hello all,
I am using MATLAB to plot the results of my numerical similuations wihout the need to open the FEM software.
In the code below, test is the name of the input file that ABAQUS deals with.
Is there a way to avoid repeating the name of the input file several times?
I am thinking about writing the name in a seprate text fil. Then, we can let MATLAB read the name from the these text files?
Can we use this solution?
------
close all
clc;
clear;
S = mfilename('fullpath');
f = filesep;
ind=strfind(S,f);
S1=S(1:ind(end)-1);
cd(S1)
%above sets the path
delete('test.odb');
delete('test.lck');
pause(2) % can this pause stop the job from getting stuck?
system('abaqus job=test cpus=3 interactive' )
------------------------------
0 Commenti
Risposta accettata
Jan
il 24 Mag 2021
myPath = fileparts(mfilename('fullpath'));
Name = 'test';
delete(fullfile(myPath, [Name, '.odb']);
delete(fullfile(myPath, [Name, '.lck']);
system(sprintf('abaqus job="%s" cpus=3 interactive', fullfile(myPath, 'test'))
It is not clear, what the pause() command should do. What is stucking where?
2 Commenti
Image Analyst
il 30 Mag 2021
You might use
recycle on % Deleted files to to recycle bin instead of completely vanishing.
and maybe they had the pause in there to make sure the file was actually deleted before the other process started to check for it. Though 2 seconds seems excessive. You might try 0.1 instead if you need it.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Startup and Shutdown in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!