|
88 | 88 | data = permute(tmp, length(size(tmp)):-1:1);
|
89 | 89 | end;
|
90 | 90 |
|
91 |
| - function write_all(obj, data) % TODO add (optional) offset |
92 |
| - % data must agree with file & dimensions |
93 |
| - % see mkarray.cc(42) |
94 |
| - tmp = permute(data, length(size(data)):-1:1); |
95 |
| - nix_mx('DataArray::writeAll', obj.nix_handle, tmp); |
| 91 | + %-- TODO add (optional) offset |
| 92 | + function write_all(obj, data) |
| 93 | + %-- Bugifx: if a data array has been created as |
| 94 | + %-- boolean or char, provide check that only logical or char |
| 95 | + %-- values can be written, otherwise the |
| 96 | + %-- error message from nix is too cryptic. |
| 97 | + if(islogical(obj.read_all) && ~islogical(data)) |
| 98 | + error(strcat('Trying to write', 32, class(data), ... |
| 99 | + ' to a logical DataArray. Provide data as logical.')); |
| 100 | + elseif(ischar(obj.read_all) && ~ischar(data)) |
| 101 | + error(strcat('Trying to write', 32, class(data), ... |
| 102 | + ' to a char DataArray. Provide data as char.')); |
| 103 | + else |
| 104 | + % data must agree with file & dimensions |
| 105 | + % see mkarray.cc(42) |
| 106 | + tmp = permute(data, length(size(data)):-1:1); |
| 107 | + nix_mx('DataArray::writeAll', obj.nix_handle, tmp); |
| 108 | + end; |
96 | 109 | end;
|
97 | 110 |
|
98 | 111 | end;
|
|
0 commit comments