Answered
How to calculate the time interval and the mean of values in a row?
Put your data in a timetable, TT, then do the following: %% Interpolate data every minute TT2 = retime(TT,'minutely','li...

7 years ago | 0

| accepted

Answered
scatter plot with narrowed color range
Here's a colorbar for you to give you an idea of how you can build your own. The colorscale is not very intuitive. part1 = ...

7 years ago | 0

| accepted

Answered
Heatmap on World Map
Here's some code from an old script of mine. Here's where I got the shapefile ( <https://www.naturalearthdata.com/downloads/10m-...

7 years ago | 0

| accepted

Answered
How to traverse table row based on sets
*Method 1 - grpstats* For the sake of simplicity, let's use only the first 5 columns in this example. %% Import data ...

7 years ago | 0

Answered
How to combine subplots so they share axes?
Here's an example using the tight_subplot function from FEX ax = tight_subplot(2,2,0,0.1,.1);hold on set(ax,'color','non...

7 years ago | 1

Answered
How can I plot a legend only for data points?
Your plot outputs multiple line handles. If that is not what you want, then you need to adjust the dimensions of *xdata* and *yd...

7 years ago | 0

| accepted

Answered
Extract values from a cell based on dates
Here's another approach %% Dummy dataset Date = datetime('2000-01-01')+days(0:364); Date.Format = 'dd/MMM/yyyy'; ...

7 years ago | 2

| accepted

Answered
Color Bar Classifying different time points
Try something like this, which is based on a previous <https://se.mathworks.com/matlabcentral/answers/414253-why-do-plotting-fun...

7 years ago | 0

| accepted

Answered
How to import a text file into matlab
fid = fopen('t.txt'); out=textscan(fid,repmat('%f',[1,12]),'delimiter',{'\t',',','{','}'},'MultipleDelimsAsOne',1) fclos...

7 years ago | 1

| accepted

Answered
I am trying to generate uniformly distributed points inside a hexagon of specific centre (other than the origin). Any help is most welcome, thank you.
Simply move the center of the polygon and the random points a distance [xc;yc] from the origin. Here is your adjusted code: ...

7 years ago | 1

Answered
how to mark 2D plot with shapes for long array?
Use the 'markerindices' argument, introduced in 2016b plot(x, y, 'markerindices', [1:10:lenght(x)]) puts markers on ever...

7 years ago | 0

| accepted

Answered
Synchronize axes limits with direct relation
This is the best I could do. I could not find a way to execute the callback when updating the axes limits from the command windo...

7 years ago | 0

Answered
Index in position 1 is invalid. Array indices must be positive integers or logical values.
Here is something fishy. sigma = func2(t,x,sigma_x,func1(kc,t)) ... function sigma = func2(t,M,sigma_M,func1) If y...

7 years ago | 1

| accepted

Answered
Add surface based on two vectors in 3D plot
It's not trivial to make a triangular surface from three points in space, at least not from the |mesh| function. I would probabl...

7 years ago | 0

| accepted

Answered
Two vectors different from each other at least at two points
sum(abs(V1-V2)~=0)>=2 Will output 1 if they differ at two or more indices. You may want to set a tolerance if they are floa...

7 years ago | 0

| accepted

Answered
single trendline for multiple series
Let's say you have single column arrays x1, x2, x3 and their corresponding y1, y2 ,y3. %% concatenate x = [x1;x2;x3];...

7 years ago | 0

| accepted

Answered
I have a 9000x21 matrix where each 60x21 section represents a frame. how do I plot each frame sequentially to make an animated plot. This is what I have so far.
Here's something you can start from %% Some data A=rand(9000,21); figure; %% Config axes axes('view',[0 90]...

7 years ago | 0

| accepted

Answered
problems with function "find". matlab doesn't match two numbere which are built equal
It is better to compare floats using a tolerance tol=0.01; M = find(abs(time-46.5)<tol); I was however able to find t...

7 years ago | 0

Answered
how to customize 2D plot lines with shapes?
The easiest way is to add it when you plot plot(x,y,'style') where 'style' is a combination of color, marker and linesty...

7 years ago | 1

| accepted

Answered
Average data along z
mean(A,3)

7 years ago | 1

Answered
HI, i want to do this type of graphic, but i do not how and if it is possible.
ax(1)=subplot(3,1,1) plot(rand(10,10)) ax(2)=subplot(3,1,2) plot(rand(10,10)) ax(3)=subplot(3,1,3) plot(rand(10...

7 years ago | 1

| accepted

Answered
change x,y,z axes position in a 3d plot graph
A bit late to the party, but there's a pretty neat undocumented feature that lets you control the position of the rulers in 2d a...

7 years ago | 3

Answered
Is it possible to use yticks only on one side?
The yticks appear on both sides due to the box being 'on', so to say. Remove them by box off This will of course also re...

7 years ago | 0

| accepted

Answered
Autoarrange title and top xlabel on plot
Sure, omit the position argument when you create the secondary axes and then add this at the end of the script primary_axis...

7 years ago | 0

| accepted

Answered
date to date month calculation coding
dt = caldiff([datetime(2018,1,1);datetime('today')]) dt = calendarDuration -9mo -4d and if you want to extra...

7 years ago | 0

Answered
regexp find next char
No real benefit in using regexp here strs = strsplit(A,'\') id = find(strcmp(strs,'A to B')==true) B = strs{id+1} ...

7 years ago | 0

Answered
In a 3d graph. Can we put limits on z axis w.r.t. x and y axis?
I made your code a bit faster and fixed your problem. %% Load data [num,txt,raw] = xlsread('Mappe2.xlsx') ; x = num(:...

7 years ago | 0

| accepted

Answered
axes & subplot etc. return double instead of matlab.graphics.axis.Axes
Probably due to your pre-2014b MATLAB release <https://se.mathworks.com/help/matlab/graphics_transition/graphics-handles-are-...

7 years ago | 2

| accepted

Answered
determining the greatest number
Read about the <https://se.mathworks.com/help/matlab/ref/max.html *max*> function You do not need to make a loop, and it is f...

7 years ago | 0

Answered
Mapping 3D velocity data onto a uniform grid
Try this [Xq,Yq,Zq] = meshgrid(min(x):0.001:max(x),min(y):0.001:max(y),min(z):0.001:max(z)); Uq = griddata(x,y,z,u,Xq,Yq...

7 years ago | 0

| accepted

Load more