Commit d4313ed5 authored by Pierre Cazenave's avatar Pierre Cazenave

Fix bug whereby the first node ID in each line was being omitted causing...

Fix bug whereby the first node ID in each line was being omitted causing errors in the resulting 2dm file, particularly if the node string has only two points
parent c20b44de
...@@ -80,12 +80,12 @@ if nargin == 5 ...@@ -80,12 +80,12 @@ if nargin == 5
% Increment the counter. % Increment the counter.
c = c + 1; c = c + 1;
if c == 1 if c == 1
fprintf(f, 'NS '); % Add the nodestring line prefix and the current node ID.
elseif c > 1 && c <= 10 fprintf(f, 'NS %i ', node_id);
elseif c > 0 && c < 10
fprintf(f, '%i ', node_id); fprintf(f, '%i ', node_id);
elseif c > 10 || ns == length(nodestring); elseif c >= 10 || ns == length(nodestring);
fprintf(f, '%i\n', node_id); fprintf(f, '%i\n', node_id);
c = 0; c = 0;
end end
...@@ -95,7 +95,7 @@ if nargin == 5 ...@@ -95,7 +95,7 @@ if nargin == 5
end end
end end
% Dump all the footer information. % Dump all the (apparently ignored) footer information.
fprintf(f, 'BEGPARAMDEF\nGM "Mesh"\nSI 0\nDY 0\nTU ""\nTD 0 0\nNUME 3\nBCPGC 0\nBEDISP 0 0 0 0 1 0 1 0 0 0 0 1\nBEFONT 0 2\nBEDISP 1 0 0 0 1 0 1 0 0 0 0 1\nBEFONT 1 2\nBEDISP 2 0 0 0 1 0 1 0 0 0 0 1\nBEFONT 2 2\nENDPARAMDEF\nBEG2DMBC\nMAT 1 "material 01"\nEND2DMBC\n'); fprintf(f, 'BEGPARAMDEF\nGM "Mesh"\nSI 0\nDY 0\nTU ""\nTD 0 0\nNUME 3\nBCPGC 0\nBEDISP 0 0 0 0 1 0 1 0 0 0 0 1\nBEFONT 0 2\nBEDISP 1 0 0 0 1 0 1 0 0 0 0 1\nBEFONT 1 2\nBEDISP 2 0 0 0 1 0 1 0 0 0 0 1\nBEFONT 2 2\nENDPARAMDEF\nBEG2DMBC\nMAT 1 "material 01"\nEND2DMBC\n');
fclose(f); fclose(f);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment