From dff5ca6c82b4e75aa378c93aa32e0ac8cd216c77 Mon Sep 17 00:00:00 2001 From: ehennestad Date: Thu, 12 Dec 2024 15:46:45 +0100 Subject: [PATCH] Update getRow.m Update function to also transpose 2D arrays (matrices) which are not vectors --- +types/+util/+dynamictable/getRow.m | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/+types/+util/+dynamictable/getRow.m b/+types/+util/+dynamictable/getRow.m index 97850f21..1fe4baf8 100644 --- a/+types/+util/+dynamictable/getRow.m +++ b/+types/+util/+dynamictable/getRow.m @@ -46,11 +46,12 @@ row{i} = select(DynamicTable, indexNames, ind); if ~istable(row{i}) - % transpose row vectors - if isrow(row{i}) - row{i} = row{i} .'; - % or permute arrays to place last dimension first - elseif ~ismatrix(row{i}) % i.e nd array where n >= 3 + if iscolumn(row{i}) + % keep column vectors as is + elseif isrow(row{i}) + row{i} = row{i} .'; % transpose row vectors + elseif ndims(row{i}) >= 2 % i.e nd array where ndims >= 2 + % permute arrays to place last dimension first array_size = size(row{i}); num_rows = numel(ind);