File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 64
64
65
65
function da = create_data_array_from_data(obj , name , nixtype , data )
66
66
shape = size(data );
67
+ % -- Quick fix to enable alias range dimension with
68
+ % -- 1D data arrays created with this function.
69
+ % -- e.g. size([1 2 3]) returns shape [1 3], which would not
70
+ % -- be accepted when trying to add an alias range dimension.
71
+ % -- TODO Remove this when a cleverer solution presents itself.
72
+ if (size(data , 1 ) == 1 )
73
+ shape = size(data , 2 );
74
+ end ;
67
75
dtype = class(data );
68
76
69
77
da = obj .create_data_array(name , nixtype , dtype , shape );
Original file line number Diff line number Diff line change 202
202
assert(f.blocks{1 }.dataArrays{2 }.dimensions{1 }.isAlias);
203
203
204
204
clear daAlias da b f ;
205
- f = nix .File(fileName , nix .FileMode .ReadOnly );
205
+ f = nix .File(fileName , nix .FileMode .ReadWrite );
206
206
assert(f.blocks{1 }.dataArrays{2 }.dimensions{1 }.isAlias);
207
+
208
+ % -- Test for the alias dimension shape work around
209
+ daAliasWa = f.blocks{1 }.create_data_array_from_data(' aliasDimWTest1' , ...
210
+ ' nix.DataArray' , [1 2 3 ]);
211
+ daAliasWa .append_alias_range_dimension();
212
+ assert(daAliasWa.dimensions{1 }.isAlias);
213
+
214
+ daAliasWa = f.blocks{1 }.create_data_array_from_data(' aliasDimWATest2' , ...
215
+ ' nix.DataArray' , [1 ; 2 ; 3 ]);
216
+ assert(isequal(daAliasWa .shape , [3 1 ]));
217
+
218
+ daAliasWa = f.blocks{1 }.create_data_array_from_data(' aliasDimWATest3' , ...
219
+ ' nix.DataArray' , [1 2 3 ; 2 4 5 ; 3 6 7 ]);
220
+ assert(isequal(daAliasWa .shape , [3 3 ]));
207
221
end
You can’t perform that action at this time.
0 commit comments