To talk on Icrontic, just register!

It only takes 30 seconds.

Have an account? Sign in:

Forgot?
zhupolongjoe
Icrontic Convert
zhupolongjoe
22 Posts

one more matlab

/////
shwaip
elaborate bot
shwaip
5,729 Posts
well, do you ever assign a value to lengthwords (which is what is returned by your fuction)?
__________________ my photostream for ic photography challenge

Anyone who wants dropbox, please use my referral link
zhupolongjoe
Icrontic Convert
zhupolongjoe
22 Posts
Ok:


function
lengthwords=wordLengths(line)
spaces=findstr(
' ', line);
index=-1;
while index~=spaces;
index==index+1
lengthwords=index(line);
return
end
end

I get error:
??? Index exceeds matrix dimensions.
Error in ==> wordLengths at 6
lengthwords=index(line);



shwaip
elaborate bot
shwaip
5,729 Posts
You need to spend time reviewing basic programming concepts. In the three threads you've posted, your code starts out almost completely incorrect, with mistakes that you should have picked up via error messages that matlab gives you.

In this question, you clearly aren't understanding how:

a) indexing works
b) matlab indexing works.

when you say:
lengthwords=index(line);

You're trying to use line (which is a string) to index into the variable index (which is a scalar).
zhupolongjoe
Icrontic Convert
zhupolongjoe
22 Posts
Jeez..I can't wait till this class ends so I can delete Matlab from my computer forever and snap the disk in half....I ace 400 level, proof-based math courses, but this 100 level computer science course is the bane of my existence.
zhupolongjoe
Icrontic Convert
zhupolongjoe
22 Posts
.............
shwaip
elaborate bot
shwaip
5,729 Posts
explain to me how you're trying to solve this problem, in psuedocode ie:

step 1: find the locations of the spaces, using findstr();
.
.
.

this doesn't have to be anything that will work at all in matlab, just to give me an idea of how to help you.

After you've written the pseudocode, then see if your code matches up with it at all.
Similar Threads
Thread Thread Starter Forum Replies Last Post
matlab help jithin Matlab Help 1 22 Dec 2008 10:16am
Please, Need help on MATLAB!!!!!!!!! mypeace Matlab Help 1 16 Oct 2008 6:13am
MATLAB HELP!!!!!!!! sykohawk Matlab Help 2 7 Oct 2008 5:25pm
gui matlab help tmh88 Matlab Help 4 30 May 2007 2:07am
Matlab help!!! pseudonym Web & Digital Media 11 11 Dec 2004 8:44pm

Go Back   Icrontic Forums > Tech: Software > General Software > Matlab Help
Jump to
This Thread Search this Thread
Search this Thread:

Advanced Search


Current time: 7:39am (GMT)
Powered by vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Get Vanilla instead. Trust me.