The code only works on Evaluation
이전 댓글 표시
This code only when run normally, N_id, N_x, N_y and N_z will give me nothing. But when i used Evaluate on the codes. It actually work, but i am not sure why
FileName = ['C:\Users\ying0018\Desktop\Right Femur\Surface_Baseline_R.inp']
disp('*******************************************************************************************************')
disp(['Current Directory: ', FileName]);
disp('*******************************************************************************************************')
fid = fopen(FileName);
SWData = textscan (fid, '%s', 'delimiter', '\n', 'whitespace', '');
SWStr = SWData{1};
NBD = strfind(SWStr,'*NODE');
Node_begin = find(~cellfun('isempty', NBD));
NED = strfind(SWStr, '**HWCOLOR COMP ');
Node_end = find(~cellfun('isempty', NED));
Node_range = (Node_end - (Node_begin + 1));
% ND : Node data, N: Nodess
ND = textscan(fid,'%d %f %f %f', Node_range,'delimiter',',','headerlines', Node_begin, 'CommentStyle','**');
N_Id = ND{1,1};
N_x = ND{1,2};
N_y = ND{1,3};
N_z = ND{1,4};
Nodes = [N_Id, N_x, N_y, N_z];
댓글 수: 6
Walter Roberson
2017년 11월 17일
Difficult to say without a copy of your input file.
Also, what does it mean to use Evaluate in this context?
Yann Yiing
2017년 11월 17일
Yann Yiing
2017년 11월 17일
Walter Roberson
2017년 11월 17일
You can zip the inp file and attach the zip
Walter Roberson
2017년 11월 17일
What name did you give to the file that the code is stored in?
Yann Yiing
2017년 11월 17일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!