By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,853 Members | 1,534 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,853 IT Pros & Developers. It's quick & easy.

Need help coding this algorithm

P: 48
Hi,

I am stuck at a major part of the code in VC++.

My algorithm is as follows:


f_name = load(filename);
//this also loads a text file. The text files contains numbers sepearted by tab. it has 4 columns in it.

sum_text = sum(f_name(:, 4)) + 1;
// here we are calculating the sum of the 4th column elements and then adding 1 to it.

[Rows, Columns] = size(f_name);
//this computes the number of rows and columns in the text file, i.e. Rows contain no.of rows andcontains no.of columns in the text file

Matched = find(f_name(:, 4) >= 20);
//this will find which row has its 4th column element > 20 and returns that row number. It will contain all row numbers that satisfy the condition --> its 4th column element >= 20

for p = 1:length(Matched)
{
R = f_name(Matched(p), 1);
//for example if the 1st row satisfies the above condition, then this will compute or return 1st row first element

G = f_name(Matched(p), 2);
//this will return 1st row, 2nd element

B = f_name(Matched(p), 3);
//this will return 1st row, 3rd element
}

Can someone help coding this one.
This is for my student project. Need help

Thanks,
Rishi
Jun 27 '07 #1
Share this Question
Share on Google+
1 Reply


sicarie
Expert Mod 2.5K+
P: 4,677
Which part of the algorithm, specifically, are you having trouble coding?
Jun 27 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.