From: Tom on
Hi,

I am working with the following section of a cell structure, which I would like to sort into numerical order:

[code] FImpedanceMag(i,j).Measurements{j,:} [/code]

It contains the following data when evaluated:

[code]
ans =
1.6877e+009

ans =
7.9977e+008

ans =
8.1619e+008

ans =
8.0566e+008

ans =
1.6604e+009

ans =
7.8736e+008

ans =
7.9498e+008

ans =
7.9671e+008

ans =
9.8088e+008

ans =
9.8716e+008

[/code]

When I use:

[code] sort(FImpedanceMag(i,j).Measurements{j,:}) [/code]

I get the following error:

??? Error using ==> sort
Too many input arguments.

I have tried reshaping the array, but no luck!

Any suggestions.
Regards,
Tom
From: us on
"Tom" <tom(a)myers16.fsnet.co.uk> wrote in message <hsk4ma$qfk$1(a)fred.mathworks.com>...
> Hi,
>
> I am working with the following section of a cell structure, which I would like to sort into numerical order:
>
> [code] FImpedanceMag(i,j).Measurements{j,:} [/code]
>
> It contains the following data when evaluated:
>
> [code]
> ans =
> 1.6877e+009
>
> ans =
> 7.9977e+008
>
> ans =
> 8.1619e+008
>
> ans =
> 8.0566e+008
>
> ans =
> 1.6604e+009
>
> ans =
> 7.8736e+008
>
> ans =
> 7.9498e+008
>
> ans =
> 7.9671e+008
>
> ans =
> 9.8088e+008
>
> ans =
> 9.8716e+008
>
> [/code]
>
> When I use:
>
> [code] sort(FImpedanceMag(i,j).Measurements{j,:}) [/code]
>
> I get the following error:
>
> ??? Error using ==> sort
> Too many input arguments.
>
> I have tried reshaping the array, but no luck!
>
> Any suggestions.
> Regards,
> Tom

please, post a simple copy/past-able snippet of data with short var names...

us
From: Jan Simon on
Dear Tom!

> sort(FImpedanceMag(i,j).Measurements{j,:})

Try round brackets:
sort(FImpedanceMag(i,j).Measurements(j,:))

Jan
From: ImageAnalyst on
I agree that posting a code snippet would help. Until then the only
thing I can think of is to encase the cell array in square brackets:

sort([FImpedanceMag(i,j).Measurements{j,:}]) ;

I know situations where that seems to help so it might be worth a try.
From: Jan Simon on
Dear Tom!
>
> > sort(FImpedanceMag(i,j).Measurements{j,:})
>
> Try round brackets:
> sort(FImpedanceMag(i,j).Measurements(j,:))

My idea fails, because SORT operates on cell strings, but not on cells containing numbers. The method of ImageAnalyst works:
sort([FImpedanceMag(i,j).Measurements{j,:}])
Now SORT operates on a vector!

Jan
 |  Next  |  Last
Pages: 1 2
Prev: Mex error
Next: 5-minute observations from data