0
Аяқталған

sortrows use

Hector 8 year бұрын updated by Pavel Holoborodko 8 year бұрын 6

I have an object X of type 100 x 4 mp

and I want to order it with the command sortrows
the sguiente way:
X = sortRows (X, 4);
but shows error:
Error in ==> sortrows at 74
ndx = sortrowsc(x_sub, col);
Error in ==> A_Var_FijaMP at 9
X=sortrows(X,4));
A_Var_FijaMP.m being my program
+1
Аяқталған

The 'sortrows' in MATLAB is hard-coded to double type, as it calls the internal MEX module which accepts only double inputs.


Please do the following changes to fix this:


1. Open sortrows.m in editor:

>> open sortrows

2. Find & change the line:

if isreal(x) && ~issparse(x) && n > 3

to


if false && isreal(x) && ~issparse(x) && n > 3

This disables call to internal MEX, switching to pure m-language implementation which is able to work with mp-matrices.


After the fix, 'sortrows' will start working for multiprecision objects:

>> A = mp(floor(gallery('uniformdata',[6 7],0)*100));
>> A(1:4,1) = 95;  A(5:6,1) = 76;  A(2:4,2) = 7;  A(3,3) = 73;
>> D = sortrows(A,[1 7])
D =
         76        79        91         0        19        41         1
         76        61        93        81        27        46        83
         95         7        73         5        19        44        20
         95         7        73        89        20        74        52
         95         7        40        35        60        93        67
         95        45        92        41        13         1        84

I will include proper implementation of 'sortrows' into next version of toolbox (will be released in few days)

si sera en la próxima versión y en muy pocos días puedo esperar

if it will be in the next version and in a few days I can wait

+1

It will be released in Windows version first, then in Linux & MacOSX.

I thought you mean the next version of Multiprecision Computing Toolbox for MATLAB ADVANPIX

+1

Yes, I meant next version of toolbox for Windows, Linux and Mac OSX.

We support all three platforms and new versions of toolbox are released for Windows first.


+1

New version of toolbox (with sortrows) has been released for Windows. Please download it from here:

http://www.advanpix.com/wp-content/plugins/download-monitor/download.php?id=1