Filter löschen
Filter löschen

Writing text from a pre-existing notpade?

1 Ansicht (letzte 30 Tage)
Mahmoud Khadijeh
Mahmoud Khadijeh am 24 Mai 2021
Kommentiert: Image Analyst am 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' )
------------------------------

Akzeptierte Antwort

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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Data Import and Export finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by