Effacer les filtres
Effacer les filtres

Writing text from a pre-existing notpade?

1 vue (au cours des 30 derniers jours)
Mahmoud Khadijeh
Mahmoud Khadijeh le 24 Mai 2021
Commenté : Image Analyst le 30 Mai 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' )
------------------------------

Réponse acceptée

Jan
Jan le 24 Mai 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 commentaires
Mahmoud Khadijeh
Mahmoud Khadijeh le 30 Mai 2021
Thank You!
it works perfectly with me.
Regards
Image Analyst
Image Analyst le 30 Mai 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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Import and Export dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by