11/29/2011

(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');



11/27/2011

(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
...