Google

Saturday, October 24, 2009

How to compile standalone exe from Matlab

http://www.onecore.net/howtocreate-standalone-executable-for-matlab-file.htm

http://www.mathworks.com/support/compilers/R2009b/

mbuild -setup

mcc -m graph.m -o graph


Do not name output file as graph.exe
it will automatically append .exe

Don't hold your breath, it takes a long time
to compile.

Connecting WebCam to Matlab




http://www.edaboard.com/ftopic325427.html


% Create video input object.
vid = videoinput('winvideo')
% Set video input object properties for this application.
% Note that example uses both SET method and dot notation method.
set(vid,'TriggerRepeat',Inf);
vid.FrameGrabInterval = 5;
% Set value of a video source object property.
vid_src = getselectedsource(vid);
set(vid_src,'Tag','motion detection setup');
% Create a figure window.
figure;
% Start acquiring frames.
start(vid)
% Calculate difference image and display it.
while(vid.FramesAcquired<=100) % Stop after 100 frames data = getdata(vid,2);
diff_im = imadd(data(:,:,:,1),-data(:,:,:,2));
imshow(diff_im);
end
stop(vid)



http://madan.wordpress.com/2007/03/23/image-capture-using-webcam-in-matlab/


Monday, October 5, 2009

FileInputStream : how to read text files

FileInputStream can be used to read text files as well:

class TestFile{
public TestFile(){
FileInputStream in = null;
StringBuilder sb = new StringBuilder();
int x = 0;
try{
in = new FileInputStream("test2.txt");
while((x = in.read()) != -1){
sb.append((char)x);
}
in.close();
System.out.println(sb.toString());
}catch(Exception e){
System.out.println(e.toString());
}
}
}