Commit 6d7144d8 authored by Michael's avatar Michael
Browse files

Fix a bug in the generated reader m-files

The matlab readers incorrectly interpreted 58 as ':', which resulted it in returning a vector rather than a scalar when index 58 is requested.
parent 2a7736a9
......@@ -813,12 +813,12 @@ void write_reader(Array<double, 3> const & ar, const string basename, bool seq,
// Write out argument-sanitizers
file << "% Sanitize the ranges:\n";
file << "if (~exist('xrange') || isempty(xrange) || isequal(xrange,':')) xrange = [1:" << sizes[0] << "]; end;\n";
file << "if (~exist('xrange') || isempty(xrange) || strcmp(xrange,':')) xrange = [1:" << sizes[0] << "]; end;\n";
if (sizes[1] > 1)
file << "if (~exist('yrange') || isempty(yrange) || isequal(yrange,':')) yrange = [1:" << sizes[1] << "]; end;\n";
file << "if (~exist('yrange') || isempty(yrange) || strcmp(yrange,':')) yrange = [1:" << sizes[1] << "]; end;\n";
else
file << "yrange = [1];\n";
file << "if (~exist('zrange') || isempty(zrange) || isequal(zrange,':')) zrange = [1:" << sizes[2] << "]; end;\n";
file << "if (~exist('zrange') || isempty(zrange) || strcmp(zrange,':')) zrange = [1:" << sizes[2] << "]; end;\n";
file << "xrange(xrange < 1) = []; xrange(xrange > " << sizes[0] << ") = [];\n";
file << "yrange(yrange < 1) = []; yrange(yrange > " << sizes[1] << ") = [];\n";
......
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