Respondida
combine between numbers and characters in one vector
You cannot mix actual numbers and strings in the same array, but you could store the numbers as strings, or use another identifi...

más de 7 años hace | 0

Respondida
Plotting a box plot and a time series on the same graph ? as a distribution over time. boxplot(reshape(fluxO2tom01and23,4,[])); and plot(o_optode_mean1,1:196)
Not sure if this is the complete answer, but you can vary the position of the boxes by the 'position' argument. |datetime| forma...

más de 7 años hace | 0

Respondida
How to write a for-loop to calculate the sum of the integers from 11 to 45?
A for loop is one of the most basic (and overused) features, so it is worth to read up on it ( <https://se.mathworks.com/help/ma...

más de 7 años hace | 0

| aceptada

Respondida
plot certain values in yaxis
1e-6:1e-2:1e-14 ans = 1.0000e-06 There are two reasons why this does not make any sense. * The step size is la...

más de 7 años hace | 1

| aceptada

Respondida
I have an image which is full black background and the image contain few of white point. How can i draw a straight line that connected most of the white point as shown in figure.
To avoid confusion, this answer is based on correspondence that has since been deleted. Original poster is looking for a type of...

más de 7 años hace | 0

| aceptada

Respondida
How can I get subscript instead in indices from sort() ??
|ind2sub| accepts multiple indices as input. It's right there in the first example of the <https://se.mathworks.com/help/matlab/...

más de 7 años hace | 0

| aceptada

Respondida
How do I change the line width in a contourslice plot?
Yes it does. |Contourslice| builds a number of patch objects, which have linewidths like any patch objects. If it really does no...

más de 7 años hace | 0

| aceptada

Respondida
Is there a way to plot a contour with a 3-Dimensional matrix?
You would probably be interested in using a <https://se.mathworks.com/help/matlab/ref/contourslice.html contourslice> plot.

más de 7 años hace | 0

Respondida
Find minimum and maximum of a two variable function on fixed interval
Just take the max/min over the desired dimension. For example: max(U,[],1) %max row-wise max(U,[],2) %max column-wise ...

más de 7 años hace | 0

Respondida
How can I change the position of the numbers in colorbar?
Rotating the ticklabels are surprisingly difficult. Ticklabels can not be rotated, but they can be replaced by normal text which...

más de 7 años hace | 1

Respondida
How do I plot the minimum and maximum temperatures for each depth? i.e. the min and max boundaries of this graph?
Assuming you have |n| series of T(d), each with data on |m| depths, just concatenate all your data in a |m| x |n| matrix and plo...

más de 7 años hace | 0

Respondida
How to display coordinates of points in "contourf"?
It's going to look real messy when you have high resolution x and y data. %% Some data [x,y,z]=peaks(20); [~,c]=cont...

más de 7 años hace | 1

| aceptada

Respondida
how do I plot input / output data so as to have a continuous bar in that range and not two simple points for each output / input?
From what you've described so far, a bar graph does not seem optimal. What about this approach instead? in=load('closing_op...

más de 7 años hace | 0

| aceptada

Respondida
Matlab's contour and colormap ignores input values
You can increase the resolution by adjusting the *levelstep* property contourf(x,y,z,'levelstep',2) Adjust the limits on...

más de 7 años hace | 0

Respondida
Getting the values from the curve fitted model
If you used |fit|: p=fit(...) %your model y=p(x) %evaluate your model at x Similarily, if you used |polyfit|: p=...

más de 7 años hace | 0

| aceptada

Respondida
How to Use Character String as a For Loop Variable.
The condition must output a logical. Use e.g. |isequal| or == if isequal(Spring_type,'Open') ... end or if S...

más de 7 años hace | 1

| aceptada

Respondida
Shaded Contour and Line Contour in one CONTOURF
Yea that's fairly easy. An example: A=peaks(100); B=peaks(75); [~,h1]=contourf(A,'linestyle','none');hold on [c,h2...

más de 7 años hace | 0

| aceptada

Respondida
How to draw 3D XYZ plot with a matrix?
I stitched this together using quiver3. Possibly a bit buggy. %%Start point coordinates A=[38 70 0; 42 70 2; 42 7...

más de 7 años hace | 1

| aceptada

Respondida
Why is the function "isequal" giving wrong answer when comparing string fields of two structure arrays?
Can't tell why |isequal| returns false in your code. However, you can easily fix it by adding some curly brackets: isequal(...

más de 7 años hace | 0

| aceptada

Respondida
restructure cell array from textscan
What about this solution? I've replaced one of the numbers in the first column with a string, just to make sure it works. ...

más de 7 años hace | 0

Respondida
less than or equal and greater than of equal operations
There is no problem with your code. In fact, if you copy your code as written in the question, you get the following results. ...

más de 7 años hace | 0

Respondida
"if it possible to only keep the value of the last two iterations"
Seems fairly trivial, just store the results in a 1x2 cell array. A=cell(1,2); for i=1:10 A{1}=A{2}; A{2}=...

más de 7 años hace | 0

| aceptada

Respondida
Intersection between line and function
Use <https://se.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections InterX> from fileexchange for high accuracy e...

más de 7 años hace | 0

Respondida
How to fit this data?
Looks more like a smoothing filter than a fitted equation. Perhaps a moving average. A moving average filter goes over your d...

más de 7 años hace | 0

| aceptada

Respondida
Saving figures as a single figure
Here's an official answer. It's very old (release 2010) but still works. <https://se.mathworks.com/matlabcentral/answers/92...

más de 7 años hace | 0

| aceptada

Respondida
How do I convert a decimal number to a time?
Alternatively, if you just want to display amount of hours and minutes. duration(hours(7.8),'format','hh:mm') ans = ...

más de 7 años hace | 2

| aceptada

Respondida
How to plot date and time on x axis and data on y axis using matlab?
The data import is all messy and you are trying to jam two cell arrays into the plot. Two options, either add the cell range of ...

más de 7 años hace | 1

Respondida
Find maximum values related to index
Ideal job for |findgroups| and |splitapply|. |VAL| is the max value in each group, located at |id_l| (local group index). Fo...

más de 7 años hace | 0

| aceptada

Respondida
How to make code repeat itself every second (Trading Toolbox)
while true %Insert code here pause(1) end Bonus, if your code takes a long time to run and you want the sc...

más de 7 años hace | 2

| aceptada

Respondida
How to connect these components in the image to make the crack continuous?
Try this, it's quite robust. However, you may want to exclude 'outliers' before interpolating. %%Read image I=imread(...

más de 7 años hace | 0

| aceptada

Cargar más