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
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com