(TIP) Matlab Plot Option

colormap
































Below code is example of matlab help document.
x = -pi:pi/10:pi;
y = tan(sin(x)) - sin(tan(x));
plot(x,y,'--rs','LineWidth',2,...
                'MarkerEdgeColor','k',...
                'MarkerFaceColor','g',...
                'MarkerSize',10)



You can describe axes on your image.
data2 = imread('map.tif');
figure(1);
iptsetpref('ImshowAxesVisible','on');
imshow(data2); %'colormap',bone(0)
set(gca, 'XTickLabel', {'a', 'b', 'c', 'd', 'e', 'f'} );
set(gca, 'YTickLabel', {100:100:700} );
xlabel('Longitude');ylabel('Latitude');



(TIP) Making a file name appending number in Matlab

It is simple and easy but I can not remember the code well when I need this code.
So I leave this code in my blog.
And I hope the code is also useful to all visitor.
Thank you.

endIndex = 10;
for j=1:endIndex
     Index = num2str(j);
     dataD = strcat(Index,'saveFile.txt')
     data = load(dataD);
end

->
This source code can load below file names sequentially.
1saveFile.txt
2saveFile.txt
3saveFile.txt
4saveFile.txt
5saveFile.txt
6saveFile.txt
7saveFile.txt
...

Screen capture and save program/ C++ source code


Created Date : 2011.11
Language :C++
Tool : Visual Studio 2008
Library & Utilized : CImage
Reference : Internet
etc. : -



I made this program to help my friend.
This progrma is screen capture program.
At first, we do whole screen capture and set region of screen to capture.
Then start capture and image saving in real-time.
The image file is saved in your program directory.
The file name of the saved image is like that "Time.jpg(EX: 11223242.jpg, 11223243.jpg...)"




The program is made based on below capture program.

#include 
void Capture() 
{ 

   
    int nx =0, ny = 0;
    CImage capImage;
    CWnd *pDesktopWnd = GetDesktopWindow();
    HDC hDC = NULL; 
    if(!pDesktopWnd) 
        return; 
    CWindowDC DeskTopDC(pDesktopWnd); 
    nx = GetSystemMetrics(SM_CXSCREEN);
    ny = GetSystemMetrics(SM_CYSCREEN); 
    if(!capImage.Create(nx, ny, 32))
        return;
    hDC = capImage.GetDC();
    BitBlt(hDC, 0,0, nx, ny, DeskTopDC.m_hDC, 0, 0, SRCCOPY); 
    capImage.Save(_T("test.jpg"), Gdiplus::ImageFormatJPEG); 
    capImage.ReleaseDC();

}


I am hard to make file name of capture image because the progrma requires UNICODE type character.

So I solved this problem as below code.

    int T = time(NULL);
    TCHAR str[100];
    wsprintf(str,_T("%d.jpg"),T);
    ImageTemp.Save(str, Gdiplus::ImageFormatJPEG);     
    ImageTemp.ReleaseDC();

source code