Wednesday, February 24, 2016

States Line disappearing in map: Solved

In matlab you can extract the states lat/lon information and plot them so that the problem of states lines disappearing can be solved.
here is an example where you can extract the state lat/lon data from the axis limit boundary and make lats/lons variables. These can be plotted with geoshow.

figure(1)
latlim = [35 45];
lonlim = [-115 -100];
    ax = worldmap(latlim, lonlim);

  states = shaperead('usastatehi','UseGeoCoords', true, 'BoundingBox', [lonlim', latlim']);
   geoshow(ax, states, 'FaceColor', [1 1 1], 'LineWidth', 3);
   lats = [];
lons = [];
for aa = 1:length(states)
lats = horzcat(lats, states(aa).Lat);
lons = horzcat(lons, states(aa).Lon);
end
geoshow(lats,lons,'DisplayType','Line', 'Color', [0 1 0])
% latlim=[floor(min(min(SatLat))),ceil(max(max(SatLat)))];
% lonlim=[floor(min(min(SatLon))),ceil(max(max(SatLon)))];
surfacem(SatLat, SatLon, double(c66in5));
hold on
plotm( y,x ) % polygon

plotm(37 , -105 , 1, 'yo')
set(gcf,'Color','white')

Thursday, February 18, 2016

Latex Installed on Windows 10

MiKTeX installed the Latex.exe in the following location:
Not so obvious, Is it?
C:\Users\myusername\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64

Wednesday, February 10, 2016

Insert Landscape pages in paper

We are often faced with a long table in the middle of the document. I used to insert a text box, then ratate it so that final view had a rotated table. However, when I went on to edit the table/text box content, it would rotate back... and things are not so easy!

This solution is easier than what I used to do:
Simply highlight the text/table to be rotated into the landscape, then go to margin, select custom, then do landscape page orientation for the selection. Voila! I am assuming that the table will occupy the whole page.

The following is from Office Support page:
https://support.office.com/en-us/article/Rotate-page-orientation-between-portrait-and-landscape-in-Word-2010-14952283-8BA7-4A52-82B9-A8487A5674B4

Use portrait and landscape orientation in the same document

  1. Select the pages or paragraphs that you want to change to portrait or landscape orientation.
    NOTE    If you select some but not all of the text on a page to change to portrait or landscape orientation, Word places the selected text on its own page, and the surrounding text on separate pages.
  2. On the Page Layout tab, in the Page Setup group, click Margins.
    page setup group
  3. Click Custom Margins.
  4. On the Margins tab, click Portrait or Landscape.
  5. In the Apply to list, click Selected text..

Tuesday, February 2, 2016

Matlab Map plot with limits

It is not so obvious to plot matlab maps with latitude and longitude limits on the axes' ends.
The following code helped me.
figure
ax = worldmap(ylim, xlim);
states = shaperead('usastatehi','UseGeoCoords', true, 'BoundingBox', [xlim', ylim']);
geoshow(ax, states, 'FaceColor', [1 1 1]);
surfacem(LatLsatf1, LonLsatf1,NDVI1);
colormap('summer')
title(['NDVI (', DOY, ')'], 'FontSize', 20)
map2 = (colormap);
map2 = flipud(map2);
colormap(map2);
cmap = colormap; % cmap nicely puts colormap into 3 col data
% colorbar
caxis([-0  1])

setm(gca,'fontsize', 12,'PLabelLocation',[ylim(1), mean(ylim), ylim(2)],'PLineLocation',[ylim(1), mean(ylim), ylim(2)],...
    'PLabelRound',-3,'MLabelLocation',[xlim(1), mean(xlim), xlim(2)],'MLineLocation',[xlim(1), mean(xlim), xlim(2)], 'MLabelRound',-3, ...
     'Grid','on')

Tuesday, December 29, 2015

Too many outputs requested. Most likely cause is missing []

This is one of the weirdest error I saw in matlab.
"Too many outputs requested. Most likely cause is missing [] around left hand side that has a comma separated list expansion."
In my case, this was caused by the following sequence of operations:
I was extracting name from a dir object. The dir returned an empty output. This caused the query in the for loop to return void. Obviously, "too many outputs requested" from a zero size variable.

Wednesday, September 30, 2015

Grab and Release the Mouse/Keyboard in NoMachine

I had an issue with NoMachine set up. The default key was alt+ctrl+left key or zero. But somehow it did not work.

I had a shortcut assigned to speaker volume by alt+ctrl+up arrow. This helped.

One solution is to uncheck the mouse and keyboard "grab" option in the setting.