i have to find distance between two projects and i have taken three attributes for this purpose which are size, project mode and a constant value.i have written code in matlab 7.but it gives error.plz see the folowing code and help me.

t = 17;

a =0;
b=0;

%size
effort = 12;
effort1=14;
if ((z=46) & (j=1.15))
a = effort;
end;


h=1;
h1 = 2;

% sum of importance weights of current project
s = z + j ;

b = s / t;

if ((z1=50) & (j1=1.15))
b = effort1;
end;

% sum of weights of previous project
e = z 1+ j1+ h1 ;

f = e / t;
p = 24.5 ;
g = f * p;

% distance
d = b - g;

disp(d)

error is:

??? Error: File: I:\MCS\MSc\matlabinstalled\work\efffff.m Line: 9 Column: 7
The expression to the left of the equals sign is not a valid target for an assignment.


plz help me to overcome this error.

== is the equality comparison operator, not =

thanx .

i have made some changes.

t = 17;

a =0;
b=0;
z=0;
z1=0;
j1=0;
%size
effort = 12;
effort1=14;
if ((z==46) & (j==1.15))
a = effort;
end;


h=1.0353;
h1 = 1.0028;

% sum of importance weights of current project
s = z + j ;

b = s / t;

if ((z1==50) & (j1==1.15))
b = effort1;
end;

% sum of weights of previous project
e = z1+ j1+ h1 ;

f = e / t;
p = 24.5 ;
g = f * p;

% distance
d = b - g;

disp(d)

but is giving folllowing resultant value which is not desirable. i need value between 0 and 1:

-1.4452 + 0.0588i

Why do you expect a value between 0 and 1?

i dont know what is "i" in resultant value? what is this?

It's a complex number.

You're using the letter 'j' in some places, and in matlab that's hardcoded to have the value i.

then what should i do to deal with i ?

How about you review your code and prove it doesn't have any problems, or notice what the problems are? Seriously can't you double check things carefully? Has that idea ever cross your mind?

what do you mean to say "Rashakil Fol " ? plz tell the solution of my problem.i have left with very short time for it.

From your posting:

if ((z==46) & (j==1.15))

What is the value of 'j' here? Where did it get set to that value? Do you use 'j' anywhere else in your code?

commented: I'm giving you bad rep not because I hate you or anything, but because the OP doesn't deserve it. -3

Doing == comparson with floating point number is usually very stupid.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.