The code only works on Evaluation
Mostrar comentarios más antiguos
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 comentarios
Walter Roberson
el 17 de Nov. de 2017
Difficult to say without a copy of your input file.
Also, what does it mean to use Evaluate in this context?
Yann Yiing
el 17 de Nov. de 2017
Yann Yiing
el 17 de Nov. de 2017
Walter Roberson
el 17 de Nov. de 2017
You can zip the inp file and attach the zip
Walter Roberson
el 17 de Nov. de 2017
What name did you give to the file that the code is stored in?
Yann Yiing
el 17 de Nov. de 2017
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!