Commit a0deba56 authored by Simon's avatar Simon
Browse files

animate_state.m and surfSparse.m small things

parent 2639154b
......@@ -271,13 +271,17 @@ function [end_index, tot_time] = animation(start_index,infostruc)
end
end
matlab2tikz('filename', [infostruc.exportPath '/frame_', num2str(t_idx)],...
'externalData',true,'showInfo',false,'checkForUpdates',false);
'externalData',true,'showInfo',false,'checkForUpdates',false,'floatFormat','%.3e');
close(f);
% fprintf([infostruc.exportPath '/t_' num2str(t_idx) '.tsv'],'infostruc.t_anim(t_idx)');
fid=fopen([infostruc.exportPath '/t_' num2str(t_idx) '.tsv'],'w');
% fprintf(fid, [ header1 ' ' header2 '\n']);
fprintf(fid, '%.2f' , infostruc.t_anim(t_idx));
fclose(fid);
fid=fopen([infostruc.exportPath '/tFine_' num2str(t_idx) '.tsv'],'w');
% fprintf(fid, [ header1 ' ' header2 '\n']);
fprintf(fid, '%.5f' , infostruc.t_anim(t_idx));
fclose(fid);
end
......
......@@ -27,25 +27,44 @@ yGes = yGes(:).';
for xIdx=1:ndiscX-1
for yIdx = 1:ndiscY-1
% create rectangles to connect
% problem: for pgfplots, if there is a node doube, it must not appear after each other.
if ~isnan(val(xIdx,yIdx))
if ~isnan(val(xIdx+1,yIdx)) && ~isnan(val(xIdx+1,yIdx+1)) && ~isnan(val(xIdx,yIdx+1))
idxLow = [sub2ind([ndiscX ndiscY],xIdx,yIdx), sub2ind([ndiscX ndiscY],xIdx+1,yIdx)];
idxHigh = [sub2ind([ndiscX ndiscY],xIdx+1,yIdx+1), sub2ind([ndiscX ndiscY],xIdx,yIdx+1)];
F = [F;idxLow idxHigh];
if idxLow(1)==idxLow(2)
F = [F;idxLow(1) idxHigh idxLow(2)];
elseif idxHigh(1) == idxHigh(2)
F = [F;idxHigh(1) idxLow idxHigh(1)];
else
F = [F;idxLow idxHigh];
end
% F = [idxLow idxHigh];
% h = patch('Faces',F,'Vertices',[xGes;yGes;kGes].',...
% 'FaceVertexCData',kGes.','FaceColor','interp',varargin{:});
elseif ~isnan(val(xIdx+1,yIdx)) && ~isnan(val(xIdx,yIdx+1))
idxLow = [sub2ind([ndiscX ndiscY],xIdx,yIdx), sub2ind([ndiscX ndiscY],xIdx+1,yIdx)];
idxHigh = [sub2ind([ndiscX ndiscY],xIdx,yIdx+1), sub2ind([ndiscX ndiscY],xIdx,yIdx+1)];
F = [F;idxLow idxHigh];
if idxLow(1)==idxLow(2)
F = [F;idxLow(1) idxHigh idxLow(2)];
elseif idxHigh(1) == idxHigh(2)
F = [F;idxHigh(1) idxLow idxHigh(1)];
else
F = [F;idxLow idxHigh];
end
% F = [idxLow idxHigh];
% h = patch('Faces',F,'Vertices',[xGes;yGes;kGes].',...
% 'FaceVertexCData',kGes.','FaceColor','interp',varargin{:});
elseif ~isnan(val(xIdx+1,yIdx)) && ~isnan(val(xIdx+1,yIdx+1))
idxLow = [sub2ind([ndiscX ndiscY],xIdx,yIdx), sub2ind([ndiscX ndiscY],xIdx+1,yIdx)];
idxHigh = [sub2ind([ndiscX ndiscY],xIdx+1,yIdx+1), sub2ind([ndiscX ndiscY],xIdx+1,yIdx+1)];
F = [F;idxLow idxHigh];
if idxLow(1)==idxLow(2)
F = [F;idxLow(1) idxHigh idxLow(2)];
elseif idxHigh(1) == idxHigh(2)
F = [F;idxHigh(1) idxLow idxHigh(1)];
else
F = [F;idxLow idxHigh];
end
% F = [idxLow idxHigh];
% h = patch('Faces',F,'Vertices',[xGes;yGes;kGes].',...
% 'FaceVertexCData',kGes.','FaceColor','interp',varargin{:});
......@@ -54,7 +73,13 @@ for xIdx=1:ndiscX-1
idxLow = repmat(sub2ind([ndiscX ndiscY],xIdx+1,yIdx),1,2);
idxHigh(1) = sub2ind([ndiscX ndiscY],xIdx+1,yIdx+1);
idxHigh(2) = sub2ind([ndiscX ndiscY],xIdx,yIdx+1);
F = [F;idxLow idxHigh];
if idxLow(1)==idxLow(2)
F = [F;idxLow(1) idxHigh idxLow(2)];
elseif idxHigh(1) == idxHigh(2)
F = [F;idxHigh(1) idxLow idxHigh(1)];
else
F = [F;idxLow idxHigh];
end
% F = [idxLow idxHigh];
% h = patch('Faces',F,'Vertices',[xGes;yGes;kGes].',...
% 'FaceVertexCData',kGes.','FaceColor','interp',varargin{:});
......@@ -92,7 +117,13 @@ for xIdx = 1:ndiscX
break
end
end
F = [F; idxLow idxHigh];
if idxLow(1)==idxLow(2)
F = [F;idxLow(1) idxHigh idxLow(2)];
elseif idxHigh(1) == idxHigh(2)
F = [F;idxHigh(1) idxLow idxHigh(1)];
else
F = [F;idxLow idxHigh];
end
% FNew = [idxLow idxHigh];
% links unten
% h = patch('Faces',FNew,'Vertices',[xGes;yGes;kGes].',...
......@@ -115,7 +146,13 @@ for xIdx = 1:ndiscX
idxHigh(2) = sub2ind([ndiscX,ndiscY],xIdx,yIdx-1);
end
end
F = [F; idxLow idxHigh];
if idxLow(1)==idxLow(2)
F = [F;idxLow(1) idxHigh idxLow(2)];
elseif idxHigh(1) == idxHigh(2)
F = [F;idxHigh(1) idxLow idxHigh(1)];
else
F = [F;idxLow idxHigh];
end
% FNew = [idxLow idxHigh];
% % links oben
% h = patch('Faces',FNew,'Vertices',[xGes;yGes;kGes].',...
......@@ -138,7 +175,13 @@ for xIdx = 1:ndiscX
idxHigh(2) = sub2ind([ndiscX,ndiscY],xIdx,yIdx-1);
end
end
F = [F; idxLow idxHigh];
if idxLow(1)==idxLow(2)
F = [F;idxLow(1) idxHigh idxLow(2)];
elseif idxHigh(1) == idxHigh(2)
F = [F;idxHigh(1) idxLow idxHigh(1)];
else
F = [F;idxLow idxHigh];
end
% FNew = [idxLow idxHigh];
% rechts oben
% h = patch('Faces',FNew,'Vertices',[xGes;yGes;kGes].',...
......
Supports Markdown
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