Contents:
Run Matlab in the Background
Unix C-shell Script
Save the following script in a file, say matlab-in-background, and make it executable:#!/bin/csh -f
unsetenv DISPLAY
nohup matlab < $1 > $2 &
Usage
Run the command:matlab-in-background [input] [output]where [input] is the script file to run by matlab, and [output] is the file to which the output should be dumped into.
Misc Tips
functions on a field in an array of structures
Assume a structure, e.g., packet, with the fieldspacket.arrivalTimeAssume an array of structures, e.g., traffic, where for every i, traffic(i) is a packet. To compute a function of one of the fields, over all structures in the array, use the cat() function. E.g., in order to compute the maximum arrival time of a packet in the traffic, use:
packet.departureTime
max(cat(1,traffic.arrivalTime))This concatenates the values of the field arrivalTime of all entries in the traffic structure array into a 1-dimensional matrix, thus enabling running the max() function on the array of reals.
没有评论:
发表评论