Thursday, May 05, 2011

[Matlab] Interact with operating system command

Problem

When using system() to execute the operating system command, the command requires the user input for further operations, but system() does not return any message to inform the user, causing the Matlab script to hang.

Solution

Use the option '-echo' to forces the output to the Command Window, allowing the user to interact with the operating system command when necessary

system(cmd, '-echo')

Reference

Matlab Help for function system()

Thursday, April 01, 2010

[CPP][Debug] This application has requested the Runtime to terminate it in an unusual way.

Environment

VC++ 2008 Expression

Syndrome

The program is terminated with the following message:

This application has requested the Runtime to terminate it in an unusual way.

Please contact the application's support team for more information.

Potential Cause

  • Inappropriate memory allocation, such as a new with undefined/abnormally large array size.
    int len;
    int *x = new int[len]; // uninitialized len

Thursday, October 02, 2008

Wednesday, September 10, 2008

[Matlab] Use 'stem' with Nonzero Base Value

Source

Syntax

stem( x, y, 'BaseValue', your_base_value );

Monday, April 14, 2008

[Matlab] Check if a var/file/dir exists

Source

Matlab Help for function exists()

Syntax

IsExist = exist('name','kind');

Code

filename = 'myfile.txt';
IsFileExist = exist( filename, 'file' );

Friday, January 11, 2008

C Shell Programming

http://heather.cs.ucdavis.edu/~matloff/UnixAndC/Unix/CShellII.html
http://www-cs.canisius.edu/ONLINESTUFF/UNIX/shellprogramming.html

Wednesday, November 14, 2007

[Matlab] Create a figure with specified location and size

Source

Matlab Help, figure

Syntax

rect = [left bottom width height];
% The unit of rect is pixel by default.
% left = the distance between the left of the figure and the left of the screen
% bottom = the distnace between the bottom of the figure and the bottom of the screen
figure( 'Position', rect );

Code