Answered
Reading HDFS from Matlab - what toolboxes do I need?
The <https://www.mathworks.com/help/matlab/ref/h5read.html |h5read|> function has come standard since Matlab release 2011a, and ...

8 years ago | 0

Answered
How to open netcdf4 file in MATLAB
If the NetCDF file you are using is one of the ones found <https://oceandata.sci.gsfc.nasa.gov/MODIS-Aqua/Binned/Monthly/CHL her...

8 years ago | 2

| accepted

Answered
How to plot a sequence of rectangular pulses with a period of 2 seconds, amplitude 1 unit, duty cycle 50%, and the pulses run for 10 seconds.
You have these lines nwid = 1; for nn = 2:nwid ... end which effectively says |for nn = 2:1|, so nothing in...

8 years ago | 0

Answered
Shade area between two curves and maintain central solid line in shaded area
Hi Matt, I recommend Kelly Kearney's <https://www.mathworks.com/matlabcentral/fileexchange/27485-boundedline-m |boundedline|...

8 years ago | 0

| accepted

Answered
Unable to read DEM file with GTOPO30s
Does <https://www.mathworks.com/matlabcentral/answers/354908-error-reading-a-dem-file-using-gtopo30-function-of-the-mapping-tool...

8 years ago | 2

| accepted

Answered
how to draw a bar chart with max and min
The <https://www.mathworks.com/help/matlab/ref/errorbar.html |errorbar|> function is designed to make graphs exactly like the on...

8 years ago | 0

Answered
How to grid data with coordinates to create a spatial plot using geoshow
Is it possible that your data vectors are in fact regular, but simply not in gridded format? To check, try scatterm(lat,lo...

8 years ago | 1

| accepted

Answered
What are the index subscripts (row, column) for the 454th element in matrix M
That depends on the size of the matrix |M|. If you know the size of |M|, use <https://www.mathworks.com/help/matlab/ref/ind2sub....

8 years ago | 1

Answered
how to regrid MPI-ESM-MR to 0.5*05 degree from 1.87 degree lat*1.87 degree lon
I think this: interp2(OY,OX,Rhum2004(:,:,i),NY,NX,'bilinear') should be interp2(OY,OX,Rhum2004(:,:,i),NY,NX,'line...

8 years ago | 0

| accepted

Answered
Speeding up Plotting Lines Using the Mapping Package
Why use a loop? You should be able to do wmline(lat*1e-7,long*1e-7) without any loops at all. If you must use a loop, y...

8 years ago | 0

Answered
Having trouble with my outputs giving me 4 decimal points when I only want 2?
Type format bank And then everything will be printed to two-decimal precision until you restart Matlab. Formatting styl...

8 years ago | 0

| accepted

Answered
Error using interp1 on MATLAB R2015b for Mac
What do you get if you type sum(A(~nanx)) I have a feeling there are some NaNs in there. Perhaps the line just above it ...

8 years ago | 0

Answered
Coordinate transformation in to lat and lon
If you know the projection, you can use <https://www.mathworks.com/help/map/ref/projinv.html |projinv|> in the form [lat,lo...

8 years ago | 0

Answered
Z-scores of time series data (temperatures)
Does the <https://www.mathworks.com/help/stats/zscore.html |zscore|> function do what you want?

8 years ago | 0

Answered
To find the average when there is NaN
Hi Thishan, On newer versions of Matlab, use test(j)=mean(A(C),'omitnan'); If you have an older version of Matlab an...

8 years ago | 0

Answered
Specify light blue for color
Hi Benjamin, I'd do something like h = patch([x3 fliplr(x4)], [y3 fliplr(y4)], 'g' 'EdgeColor','g'); set(h,'faceco...

8 years ago | 1

Answered
How do I combine two images of different sizes like a photo frame?
Here's a quick and dirty way. % Load images: man = imread('john-cena-3.jpg'); frame = imread('Transparent_Easter_F...

8 years ago | 1

Answered
How to make a video from .png images?
In a loop use |imread| to import each image into Matlab, then follow the "Create AVI file from Animation" example in the <https:...

8 years ago | 0

Answered
Display location of gps using geoshow()
I think |geoshow| _is_ plotting the data you're giving it, but you're only plotting the very last values in your |lat,lon| datas...

8 years ago | 0

| accepted

Answered
How to change figure size within the figure window
I think you want to change the position of the axes, not the figure. So try ax1pos = get(gca,'position') which will giv...

8 years ago | 3

| accepted

Answered
How to find average of two lines on a graph
Looks like a classic <https://www.mathworks.com/matlabcentral/answers/109922-averaging-hysteresis-data-how-to-do-it hysteresis l...

8 years ago | 0

Answered
how to find value of y from a graph with a known x value
Hi Ross, The data you provide make a multi-valued function. There are several possibly y values for any given x value, so |i...

8 years ago | 0

| accepted

Answered
changing the running variable in a "for" loop
Yes, I see the problem. It does not make sense to have the |for| loop variable be the same name as a variable you're defining wi...

8 years ago | 0

Answered
How to plot set of 3d lines in a box with their end coordinates?
Perhaps you want this? plot3([data1(:,1) data1(:,4)]',[data1(:,2) data1(:,5)]',[data1(:,3) data1(:,6)]') If that's not ...

8 years ago | 0

Answered
How to scale colors in a surface plot?
Ah, that's because |surf| and |pcolor| delete a row and column of data. I know, it's nonsensical. Try this instead: imagesc...

8 years ago | 1

| accepted

Answered
Can i use the function 'getnc' for a element that has four dimensions? if so, how? and if not what else can i use to make my extraction from a file in 'nc' format?
Hi Samantha, Is there a reason you need to use |getnc|? That's old code that was developed 25 years ago. Matlab now comes st...

8 years ago | 0

Answered
Issue overlaying contour on Usa background
I think you want contourm(POP_coords.lat, POP_coords.lon, rain, 10)

8 years ago | 0

Answered
Interpolate data on a single point
Hi Andrew, Your question is a little bit unclear. It would helpful to have a minimal working example, but from what I unders...

8 years ago | 0

| accepted

Answered
Why does length sometimes read the number of columns instead of the number of rows?
|length| just tells you the longest dimension. If you're talking about a table (the piece of furniture), its length is always it...

8 years ago | 2

| accepted

Answered
How to reduce vectors sizes if an element in a parent vector equals to zero without accessing for loop
Hi George, Yes, there's a very efficient way to do this in Matlab without loops. Get the indices of all |P| = 0 like this: ...

8 years ago | 0

| accepted

Load more