xvi Contents
10.1.16 Reopen Presaved Figure and/or Plot Axes ..............................................547
10.1.17 Set Axes SortMethod to Childorder and Reduce Transparency ............5 48
10.2 Updating Graphs and Images in Real Time ..........................................................549
10.2.1 Axes Update .................................................................................................. 549
10.2.2 Plot and Image Update ................................................................................550
10.2.3 Legends and Colorbars ............................................................................... 552
10.2.4 Accessing Object Properties .......................................................................553
10.2.5 Listeners and Callbacks ..............................................................................554
10.2.6 Trading Accuracy for Speed .......................................................................555
10.2.7 Avoid Update to the Same Value ............................................................... 557
10.2.8 Cache Graphic Handles .............................................................................. 557
10.2.9 Avoid Interlacing Property get and set ....................................................558
10.2.10 Use hgtransform to Transform Graphic Objects ....................................559
10.3 Figure Window Performance Aspects ................................................................... 559
10.3.1 Use Hardware-Accelerated OpenGL Renderer and Functionality ...... 560
10.3.2 Set a Nondefault WVisual/XVisual Property Value .............................. 561
10.3.3 Disable BackingStore ...................................................................................5 62
10.3.4 Disable DoubleBuffer .................................................................................. 562
10.3.5 Set a Manual DitherMapMode on Old Platforms ...................................563
10.3.6 Reuse Figure Windows ...............................................................................563
10.3.7 Sharing Data between GUI Callback Functions .....................................564
10.3.8 Disable Anti-Aliasing .................................................................................. 564
10.3.9 Use Smaller and Fewer Figure Windows ................................................. 564
10.4 GUI Preparation and Responsiveness ....................................................................565
10.4.1 Creating the Initial GUI ..............................................................................565
10.4.2 Presenting User Feedback .......................................................................... 575
10.4.3 Performing Asynchronous Actions ..........................................................584
10.5 Avoiding Common Pitfalls ...................................................................................... 591
10.5.1 Minimize Intentional Pauses ..................................................................... 591
10.5.2 Delete Unused Graphic Objects ................................................................. 592
11 I/O Techniques .................................................................................................................... 593
11.1 Reducing the Amount of I/O .................................................................................. 593
11.2 Avoiding Repeated File Access ............................................................................... 595
11.3 Reading and Writing Files ....................................................................................... 597
11.3.1 Text versus Binary Format .......................................................................... 597
11.3.2 Text File Pre-Processing .............................................................................. 598
11.3.3 Memory-Mapped Files ................................................................................ 598
11.3.4 Reading Files Efciently .............................................................................600
11.3.5 Writing Files Efciently ..............................................................................604
11.4 Data Compression and the save Function ............................................................ 607
11.5 Excel Files (and Microsoft Ofce Files in General) .............................................. 614
11.6 Image Files ................................................................................................................. 620
11.7 Using Java and C I/O ................................................................................................622
11.8 Searching, Parsing, and Comparing Files ............................................................. 625
11.8.1 Searching for Files ....................................................................................... 625
11.8.2 Parsing and Scanning Files ........................................................................ 626
11.9 Additional Aspects ................................................................................................... 627
11.9.1 Using p-Code ................................................................................................627