[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HELP :: if() problems encountered

From: shoker_17
Subject: Re: HELP :: if() problems encountered
Date: Fri, 15 Sep 2006 23:11:50 -0700 (PDT)

yes...i believe its correct logically but then my result is wrong.
wrong in a sense that the system does not give me the values that were less
than 1.
instead, the values of the matrix displayed are of 1 and less than 1.

maybe you all can try out the my simple codes.
Hmm...maybe my implementations are wrong.

===================my codes======================


##define global variables
global x_odd;
global x_even;
global y_odd;
global y_even;

##load grayscale colour map

##retrieve the RGB data from JPEG file

##changing from RGB color format to Octave image format
[x,map]= rgb2ind(r,g,b);

##to change to pixel values to 0.0 or 1.0
gray = ind2gray(x,map);
monoColor = mat2gray(gray);

##to display the black and white matrix

##to retrieve matrix size

##to compute row values
if (mod(row,2) == 1)
        x_odd = floor(row/8) + 1;
        printf("The value of x_odd = %d\n", x_odd);
        x_even = floor(row/8);
        printf("The value of x_even = %d\n", x_even);

##to compute column values
if (mod(column,2) == 1)
        y_odd = floor(column/8) + 1;
        printf("The value of y_odd = %d\n", y_odd);
        y_even = floor(column/8);
        printf("The value of y_even = %d\n", y_even);



##to find the number of consecutive black pixels horizontally
for x = 1 : row
        for y = 1 : column
##              test(x,y)=floor(monoColor(x,y));

save -text 'test.txt' test;
save -text 'chinese1.txt' monoColor;


===================my codes======================


Quentin Spencer wrote:
> shoker_17 wrote:
>> Hmm...actually, i believe that my for loop and if statement are correctly
>> logically but it seems that i have problem retrieving those values less
>> than
>> 1 from the matrix. This seems to me that either i use the "if()" wrongly
>> or
>> the system cannot recognise the "<1" condition.
>> paul,
>> your statement cant seem to work. instead of those values less than zero,
>> it
>> only manage to find the following output but thanks anyway! : )
> I don't seen any reason why Paul' suggestion isn't working. I suggest 
> checking the input to see if it's what you think it is.
> Quentin
> _______________________________________________
> Help-octave mailing list
> address@hidden
View this message in context:
Sent from the Octave - General forum at

reply via email to

[Prev in Thread] Current Thread [Next in Thread]