%% Send MIDI Messages to Device
% Query your system for available MIDI device output ports. Use the availableDevices struct to specify a valid MIDI device and create a mididevice object.

availableDevices = mididevinfo;
device = mididevice(availableDevices.output(2).ID);

% Create a pair of NoteOn messages (to indicate Note On and Note Off) and send them to your selected MIDI device.

msgs = midimsg('Note',1,48,64,0.25);
midisend(device,msgs)

% Copyright 2012 The MathWorks, Inc.