Thread Subject: subsindex error

Subject: subsindex error

From: Pramod chakrapani

Date: 8 Nov, 2009 04:58:01

Message: 1 of 2

function [c,c_cnt] = kmeans(pts, nc)

mn = min(pts);
mx = max(pts);

[length, dim] = size(pts);

c_cnt = zeros(nc,dim);
.
..
...
....


return

when i try to run in debug mode. matlab is giving this error

??? Error using ==> subsindex
Function 'subsindex' is not defined for values of class 'struct'.

Can anyone please tell me whats the problem?

Regards
Pramod

Subject: subsindex error

From: Steven Lord

Date: 8 Nov, 2009 23:13:48

Message: 2 of 2


"Pramod chakrapani" <pramod1561@gmail.com> wrote in message
news:hd5j4p$5mu$1@fred.mathworks.com...

*snip*

> when i try to run in debug mode. matlab is giving this error
>
> ??? Error using ==> subsindex
> Function 'subsindex' is not defined for values of class 'struct'.
>
> Can anyone please tell me whats the problem?

That means MATLAB thinks you're trying to use a struct array as the index
into a variable.

x = 1:10;
s = struct('y', 1);
x(s)

Use "DBSTOP IF ERROR" to help you locate the cause of this problem (either
where the index you expected to be a double array is becoming a struct
array, or where the function you're trying to call on a struct is being
interpreted as a variable) and fix it.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com