plotyy - plot with two y-axes, independently control each axis
notes:
(1) specify the x-axis to be exactly the same for both
(2) define the handles for the axes and lines/objects AX(1) is left axis handle, AX(2) is right axis handle
long convoluted example:
[AX,H1,H2] = plotyy(jda(event),sei(event), ...
jda(event),dis(event));
set(get(AX(1), 'Ylabel'), 'String', 'seismicity (m/s)', ...
'FontName', 'Arial', 'FontSize', 12, 'FontWeight', 'bold')
set(get(AX(2), 'Ylabel'), 'String', 'discharge (m^3/s)', ...
'FontName', 'Arial', 'FontSize', 12, 'FontWeight', 'bold')
set(AX(1), 'YLim', [0 .000001], ...
'XLim', [axismat(1) axismat(4)], ...
'XTick', axismat, ...
'YTick', ...
[0 .0000002 .0000004 .0000006 .0000008 .000001], ...
'LineWidth',1.5, ...
'FontName', 'Arial', 'FontWeight', 'bold', 'FontSize', 12)
set(AX(2), 'YLim', [0 5000], ...
'XLim', [axismat(1) axismat(4)], ...
'XTick', axismat, ...
'YTick', [0 1000 2000 3000 4000 5000], 'LineWidth',1.5, ...
'FontName', 'Arial', 'FontWeight', 'bold', 'FontSize', 12)
set(H1, 'Marker', 'o', 'LineStyle', 'none', 'MarkerSize', 3);
set(H2, 'LineWidth', 2);
axis ([AX(1) AX(2)], 'square');
xlabel('julian day','FontName', 'Arial', ...
'FontWeight', 'bold', 'FontSize', 12);
set(gca, ...
'LineWidth',1.5, ...
'FontName', 'Arial', 'FontWeight', 'bold', 'FontSize', 12)
Tuesday, November 30, 2010
Monday, November 29, 2010
How to put Excel data into Matlab and retain the 'cell' structure
1. Make your cell structure by using curly brackets:
A={1}
2. Copy the excel data to the clipboard
3. Then open up "A" and right click on the top left cell-- choose 'paste excel data'
4. Save your variable A
5. Use it in Matlab:
B = cell2mat(A(row # to start on : row # to end on , column # );
A={1}
2. Copy the excel data to the clipboard
3. Then open up "A" and right click on the top left cell-- choose 'paste excel data'
4. Save your variable A
5. Use it in Matlab:
B = cell2mat(A(row # to start on : row # to end on , column # );
Labels:
matlab
Subscribe to:
Posts (Atom)