|
| 1 | +% nix.Utils provides utility functions accessing the nix backend. |
| 2 | +% |
| 3 | +% Utility functions, do not use out of context! |
| 4 | +% |
| 5 | +% |
1 | 6 | % Copyright (c) 2016, German Neuroinformatics Node (G-Node)
|
2 | 7 | %
|
3 | 8 | % All rights reserved.
|
|
52 | 57 | r = nix.Utils.createEntityArray(list, objConstructor);
|
53 | 58 | end
|
54 | 59 |
|
55 |
| - % This method calls the nix-mx function specified by 'nixMxFunc', handing |
56 |
| - % over 'handle' as the main nix entity handle and 'relatedHandle' as a |
57 |
| - % second nix entity handle related to the first one. |
58 |
| - % 'objConstructor' requires the Matlab entity constructor of the expected |
59 |
| - % returned nix Entities. |
60 | 60 | function r = fetchObjListByEntity(obj, mxMethodName, relatedHandle, objConstructor)
|
| 61 | + % This method calls the nix-mx function specified by 'nixMxFunc', handing |
| 62 | + % over 'handle' as the main nix entity handle and 'relatedHandle' as a |
| 63 | + % second nix entity handle related to the first one. |
| 64 | + % 'objConstructor' requires the Matlab entity constructor of the expected |
| 65 | + % returned nix Entities. |
| 66 | + |
61 | 67 | mxMethod = strcat(obj.alias, '::', mxMethodName);
|
62 | 68 | list = nix_mx(mxMethod, obj.nixhandle, relatedHandle);
|
63 | 69 | r = nix.Utils.createEntityArray(list, objConstructor);
|
|
96 | 102 | nix_mx(mxMethod, obj.nixhandle, handleArray);
|
97 | 103 | end
|
98 | 104 |
|
99 |
| - % Function can be used for both nix delete and remove methods. |
100 |
| - % The first actually removes the entity, the latter |
101 |
| - % removes only the reference to the entity. |
102 | 105 | function r = deleteEntity(obj, mxMethodName, idNameEntity, nixEntity)
|
| 106 | + % Function can be used for both nix delete and remove methods. |
| 107 | + % The first actually removes the entity, the latter |
| 108 | + % removes only the reference to the entity. |
| 109 | + |
103 | 110 | mxMethod = strcat(obj.alias, '::', mxMethodName);
|
104 | 111 | id = nix.Utils.parseEntityId(idNameEntity, nixEntity);
|
105 | 112 | r = nix_mx(mxMethod, obj.nixhandle, id);
|
|
165 | 172 | % -----------------------------------------------------------
|
166 | 173 |
|
167 | 174 | function r = transposeArray(data)
|
168 |
| - % Data must agree with file & dimensions; see mkarray.cc(42) |
| 175 | + % Data must agree with file & dimensions; see mkarray.cc(42) |
| 176 | + |
169 | 177 | r = permute(data, length(size(data)):-1:1);
|
170 | 178 | end
|
171 | 179 |
|
172 | 180 | function r = handleIndex(idx)
|
173 |
| - % Matlab uses 1-based indexing opposed to 0 based indexing in C++. |
174 |
| - % handleIndex transforms a Matlab style index to a C++ style |
175 |
| - % index and raises the appropriate Matlab error in case of an |
176 |
| - % invalid subscript. |
| 181 | + % Matlab uses 1-based indexing opposed to 0 based indexing in C++. |
| 182 | + % handleIndex transforms a Matlab style index to a C++ style |
| 183 | + % index and raises the appropriate Matlab error in case of an |
| 184 | + % invalid subscript. |
| 185 | + |
177 | 186 | if (idx < 1)
|
178 | 187 | err.identifier = 'MATLAB:badsubscript';
|
179 | 188 | err.message = 'Subscript indices must either be real positive integers or logicals.';
|
|
0 commit comments