bugGNU Octave - Bugs: bug #33226, Value of variable changes...

 
 

bug #33226: Value of variable changes unexpectedly; print statement is repeated unexpectedly

Submitted by:  Zhiyang Ong <zhiyang>
Submitted on:  Wed 04 May 2011 09:41:00 AM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: InvalidAssigned to: None
Originator Name: Zhiyang OngOpen/Closed: Closed
Release: 3.2.4Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 04 May 2011 04:39:42 PM UTC, comment #1:

This is not an Octave issue. Your program calls

which returns num_row as a string, not a number. There are probably much simpler ways of getting your data into Octave. But, if you continue with the current approach you need to use 'num_row = str2num(num_row)' after the system() call.

To see what is happening, try the following code which uses printf to print a string using a decimal format code. You can see that the output values are the decimal ASCII values for 1 (49) and 0 (48) and together make the number of rows you were expecting.

Rik <rik5>
Project Administrator
Wed 04 May 2011 09:41:00 AM UTC, original submission:

The values of the variables "num_col" and "ncc" change unexpectedly from 1000 to values such as 10, 48, or 49. Likewise, the values of the variables "num_row" and "nrr" change unexpectedly from 2 to 50, 10, or otherwise.

I did not update the values of these variables.

Furthermore, the following print statements are repeated unexpectedly.

printf('### Number of rows: %dn',num_row)
printf('### Number of columns: %dn',num_col)
printf('=== Number of rows: %dn',int2str(nrr))
printf('=== Number of columns: %dn',int2str(ncc))

The behavior of the script is nondeterministic, but is repeatable.

I executed the script with an input argument (filename of the log file).
process_sin_tb.m sin_tb.dat

The following is an extract from the terminal session of executing the GNU Octave script.

status = 0.00000000000000e+00
num_row = 10000

nrr = 10000

status = 0.00000000000000e+00
num_col = 2

ncc = 2

### Number of rows: 49
### Number of rows: 48
### Number of rows: 48
### Number of rows: 48
### Number of rows: 48
### Number of rows: 10
### Number of columns: 50
### Number of columns: 10
=== Number of rows: 52
=== Number of rows: 57
=== Number of rows: 32
=== Number of rows: 32
=== Number of rows: 52
=== Number of rows: 56
=== Number of rows: 32
=== Number of rows: 32
=== Number of rows: 52
=== Number of rows: 56
=== Number of rows: 32
=== Number of rows: 32
=== Number of rows: 52
=== Number of rows: 56
=== Number of rows: 32
=== Number of rows: 32
=== Number of rows: 52
=== Number of rows: 56
=== Number of rows: 32
=== Number of rows: 32
=== Number of rows: 49
=== Number of rows: 48
=== Number of columns: 53
=== Number of columns: 48
=== Number of columns: 32
=== Number of columns: 32
=== Number of columns: 49
=== Number of columns: 48
### ii is now: 2
### ii is now: 3
### ii is now: 4
### ii is now: 5
### ii is now: 6
### ii is now: 7
### ii is now: 8
### ii is now: 9
### ii is now: 10
### ii is now: 11

Zhiyang Ong <zhiyang>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #23348:  process_sin_tb.m added by zhiyang (10KiB - text/x-objcsrc)
file #23349:  sin_tb.dat added by zhiyang (238KiB - application/x-ns-proxy-autoconfig)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by zhiyang (Submitted the item)
  • -unavailable- added by zhiyang
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 04 May 2011 04:39:42 PM UTCrik5StatusNone=>Invalid
      Open/ClosedOpen=>Closed
    Wed 04 May 2011 09:41:00 AM UTCzhiyangAttached File-=>Added process_sin_tb.m, #23348
      Attached File-=>Added sin_tb.dat, #23349
      Carbon-Copy-=>Added zhiyang

    Back to the top


    Powered by Savane 3.1-cleanup1