C++/Need help coding this algorithm
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
It seems you have to convert some code from Matlab into C++. Please spend some time in learning the language - it will be an easy conversion then. You can start by looking at Bruce Eckel's book "Thinking in C++" which has both online and print versions. However, if you're in a hurry, I'm sorry I could not be of much help.