Answered
How does regexprep work ? Clarify understanding
I think you're trying to make your pattern more complicated than necessary... building a regular expression via |sprintf| is rar...

9 years ago | 1

Answered
Why does squeeze transpose my matrices without my permission and how to stop it?
You could set up a function that uses permute but allows for unlimited dimensions: mysqueeze = @(x) permute(x, [3:ndims(x) ...

9 years ago | 2

Answered
How to creat topology with FOR loop
As Walter suggested, for R2015b or later, use graph objects. Prior to that, take a look at |gplot|: data = [... 1 0 0...

9 years ago | 0

| accepted

Answered
Plotting global flux data with colormap
Your example image looks very Ferret-y, so I'm assuming your data is currently in netCDF files. Can you give us some more deta...

9 years ago | 3

| accepted

Answered
Is there a way when using shortestpath to not only get the sequence of the nodes but also the edges between those nodes as output?
You've pretty much done all the work already. Once you have the indices to the edges, all you need to do is query the graph's e...

9 years ago | 3

| accepted

Answered
Convert to MATLAB date number
If you have a newer version of Matlab, you can parse this directly to a datetime object a = '2015-033T18:00:00'; d = dat...

9 years ago | 1

| accepted

Answered
contours plot over heat map in matlab
By default, the color limits of an axis are set to span the maximum range of plotted objects that _could_ use a colormap. In yo...

9 years ago | 2

| accepted

Answered
Annotation box left corner position
A few things are happening here. First, by default, the alignment of the text in an annotation text box is in the upper right ...

9 years ago | 9

| accepted

Answered
How to make the subplots look larger and use the space judiciously.
To use the subaxis function, you need to follow the link provided there on the stackoverflow answer you reference (or this one: ...

9 years ago | 2

| accepted

Answered
Vectorization of anonymous functions
I don't think there's any way to force |matlabFunction| to properly parse the contents of its functions and adapt to vector inpu...

9 years ago | 3

| accepted

Answered
Dendrogram node line thickness based on node population
The line handles returned by the dendrogram function correspond to the pairs in the z. You can see this more clearly if you col...

10 years ago | 0

Answered
How can I convert shapefiles to graph
A few questions: * Do you have the Mapping Toolobx? If so, look at |shaperead| to read the file in. * What version of Matla...

10 years ago | 0

Answered
How can I convert a 3 dimensional matrix into a single cell
Is this what you want? x = rand(4,3,2); x = {x};

10 years ago | 0

Answered
change the scale on graph
You can simply change the |YTickLabel| property: ax = axes; plot(1:10) ax.YTickLabel = strtrim(cellstr(num2str(2 * ax...

10 years ago | 0

Answered
Put lat/lon points onto an 80km x 80km grid
The |hist3| function will do the main binning for you, once you define your bin edges. A perfect 80km x 80km grid might be a li...

10 years ago | 1

Answered
White space in map grid.
The mapping toolbox functions clip data that intersect the map frame. With coarsely-resolved data, this can leave some undesire...

10 years ago | 0

| accepted

Answered
Align Two Data Sets by Date and Location Where Both Data Sets Are Missing Data Points at Random Dates and Locations?
The |ismember| and |unique| functions, with the |'rows'| option in both, should help: data1 = [... 20050505 ...

10 years ago | 0

Answered
How to set a color for a certan value (without showing that value in the colorbar)?
I suggest changing the 0-values to NaNs; in a surface plot, those values aren't plotted, so the background axis color shows thro...

10 years ago | 2

| accepted

Answered
Saving git log number of the current commit in MATLAB
To simply query using the git command via the OS: [s,git_hash_string] = system('git rev-parse HEAD') Not sure how this m...

10 years ago | 4

| accepted

Answered
Vlookup technique in Matlab
My <https://github.com/kakearney/vlookup-pkg vlookup> function does this (using the same method Walter describes, in a nice litt...

10 years ago | 2

Answered
Any simple way to change a struct with fields of length "n" to a struct of length"n"?
How about this? A.time = [1 4 6 8 9]; A.field2 = [5 6 7 8 9]; A.field3 = [23 423 2 4 7]; B.time = [3 7]; B.fiel...

10 years ago | 0

Answered
Using logical AND in an if statement?
When evaluated on a vector, conditional statements return true only if all elements of the vector match the condition. So ...

10 years ago | 0

| accepted

Answered
Divided colorbar automatically. Stop the blending of colors displayed
The default number of colors in a colormap is 64; if you decrease the number of colors, you get more discrete blocks: color...

10 years ago | 2

| accepted

Answered
Algo for finding nearest coordinates of arbitrary point along complex 3D line?
I recommend <http://www.mathworks.com/matlabcentral/fileexchange/34869-distance2curve distance2curve.m>.

10 years ago | 0

Answered
interp3 gives error in some cases and accept some cases with the same size of meshgrid !
The difference between |ndgrid| and |meshgrid| is how they treat the first two dimensions. size_x = 3; size_y = 4; ...

10 years ago | 1

Answered
Repetition of values number of times
The code (in the future, it's more convenient for readers if you post short code snippets like this, rather than including them ...

10 years ago | 0

| accepted

Answered
Plot legend shows same color for 2 graphs
What are the dimensions of your variables? If any are arrays rather than vectors, they will create multiple lines. In that cas...

10 years ago | 0

Answered
Loss of precision with netcdf time when using datenum
I wrote a function, <https://github.com/kakearney/daynoleap2datenum-pkg daynoleap2datenum>, that does the conversion that Peter ...

10 years ago | 1

| accepted

Answered
Logical operations on matrix
Assuming I'm understanding your intent, a better way to do this would be with |histc|. No loop necessary: hQ = 12; hQIn...

10 years ago | 1

| accepted

Answered
Checking if points are contained within a shape
Do you have the Mapping Toolbox? If so, |polyxpoly| may be helpful to calculate exactly where you'll hit the polygon boundary. ...

10 years ago | 1

Load more