Writing text from a pre-existing notpade?

조회 수: 1 (최근 30일)
Mahmoud Khadijeh
Mahmoud Khadijeh 2021년 5월 24일
댓글: Image Analyst 2021년 5월 30일
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' )
------------------------------

채택된 답변

Jan
Jan 2021년 5월 24일
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
Mahmoud Khadijeh
Mahmoud Khadijeh 2021년 5월 30일
Thank You!
it works perfectly with me.
Regards
Image Analyst
Image Analyst 2021년 5월 30일
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.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by