Answered
How do you make vertical lines from the boundary plane of a plot to connect to the corners of its surface?
* Get corners of the surface and Z-values in those points * Use plot3 to plot the four lines figure;hold on xv ...

7 years ago | 0

| accepted

Answered
how to extract a certain row out of a matrix
ind=ismember(a,[0 1],'rows'); b=a(ind,:)

7 years ago | 1

| accepted

Answered
Problem with the cycle
Center=B(1:10:end)

7 years ago | 0

| accepted

Answered
Chart regions of pixels onto new image
_"when I predefined the new image as image = zeros(256,256) ... (The image integrity wasn't preserved, ie the pixel values weren...

7 years ago | 0

Answered
How is to read and write a text file in matlab?
Getting the table-format in the text is fixed easily by adding the arguments ...,'newline','pc') Have not been able to ...

7 years ago | 0

| accepted

Answered
Color-coding a 2D plot
The simplest way to create an animation is to first create a plot and then update the 'XData', 'YData' and 'ZData' properties (o...

7 years ago | 0

| accepted

Answered
How to invert parts of a matrix
out=reshape(A,3,3)'

7 years ago | 2

| accepted

Answered
How to match two different matrices
I've made an attempt to fix your code and match the two time-vectors. I've converted your time-vectors to |datetime| format and ...

7 years ago | 1

| accepted

Answered
Contour Plot result very different
Here is a plot I made using |surf|: data=xlsread('Kitap1.xlsx'); X=data(:,1); Y=data(:,2); V=data(:,3); [Xq,Yq]...

7 years ago | 0

| accepted

Answered
How to remove Icons from legend.
You are creating a problem by trying to display results in the legend, which is not what it is intended for. Use an textbox ...

7 years ago | 2

| accepted

Answered
how to select an element from each row in a matrix given a vector of column indeces per row (no for loops)
If you want one value from each row, then you could use sub2ind, like this: A(sub2ind(size(A),1:size(A,1),b')) This is u...

7 years ago | 5

| accepted

Answered
Repeat parts of a matrix
This should work B = [1 2; 3 4; 1 2; 3 4; 5 6; 7 8; 5 6; 7 8; 9 10; 11 12; 9 10; 11 12]; A = [1 2; 3 4 ; 5 6; 7 8; 9 10;...

7 years ago | 1

| accepted

Answered
How do I get 4 large subfigures to be the same size when adding a colorbar to only two of them?
I have dealt with this issue by adding the colorbar inside (as opposed to e.g. 'eastoutside') the plot and then moving it afterw...

7 years ago | 1

Answered
Find time of slope change
If you have the signal processing toolbox, you can try the function |findchangepts|. I believe the very similar |ischange| would...

7 years ago | 3

| accepted

Answered
Using regular expressions to identify names and unit from string
You could do it in two steps, like this: str='name1/name2 [C]' %%Extract unit, if there is one exp=']|[|}|{...

7 years ago | 0

| accepted

Answered
How to change the order of the Y axis and not flip the image?
You could try this: I=imread('cameraman.tif'); figure; subplot(1,2,1) imshow(I);axis on subplot(1,2,2) I2=fl...

7 years ago | 2

| accepted

Answered
How to determine and plot a probability density function?
You can use the following function form the statistics toolbox ksdensity(SoldElectricity) Note that the function outputs...

7 years ago | 0

Answered
plot each series of one big dataset with each different color
data=readtable('data.xlsx') [n,~,id]=unique(data(:,3)) figure;hold on for i=1:numel(n); h(i)=plot(data{id=...

7 years ago | 0

Answered
Interpolate Missing data and make line smooth
Try this. GRAY=imread('204.jpg'); threshold = graythresh(GRAY); BW = im2bw(GRAY, threshold); %%Find Coordinates o...

7 years ago | 0

Answered
How to extend curve fit beyond data points?
You have the coefficients of the 'power1' function stored in |fitresult|. It probably looks something like this: fitresult = ...

7 years ago | 2

| accepted

Answered
How do you make a line with an arrow halfway between 2 points?
Let's say you want an arrow from between [X1 X2],[Y1 Y2]. We use annotation but specify the arrow coordinates by the axes coordi...

7 years ago | 0

Answered
Getting a value from vector A to equal the corresponding value from B at the same point in the vector once criteria have been met.
Try something like this, ChargeCapacity=nan(size(CapacityAh)); ind=find(CurrentA==0 & CapacityAh>0); ChargeCapacity(i...

7 years ago | 0

| accepted

Answered
Can I use contourf with two matrices?
Perhaps you are looking for a density plot, try this: hist3([fX(:), fY(:)],'CDataMode','auto') You can increase the num...

7 years ago | 1

| accepted

Answered
Dynamic variables in loop
Here is something I stitched together to plot the chipcounts. Perhaps not the most efficient code, but no need for dynamic varia...

7 years ago | 1

| accepted

Answered
How to hide areas of contourf?
Use inpolygon to see if value is within frame, and set others to zero. Here is a small example %%Data [x,y,z]=peaks(100...

7 years ago | 1

Answered
Define properties of colorbar
I'm just gonna sum up the comment chain as an answer for future reference. Walter Robinson gave an excellent solution for de...

7 years ago | 1

| accepted

Answered
Straightening image from X-ray tomography
Here is something I have stitched together that seems to work fairly well. %%Load Image, rotate and convert to binary ...

7 years ago | 0

| accepted

Answered
Finding peaks and troughs of sinusoidal from a Matrix and elements bounded within
Since you did not attach the data, I had to start from your attached image. Therefore my x- and y-values are not scaled correctl...

7 years ago | 1

| accepted

Answered
how can i add text inside subplot(1,3,3) writing code
Here are two methods. In the first one, x and y refers to the axis coordinates. Make sure you set the current axis to the correc...

7 years ago | 1

Answered
How to assign individual colors to grouped and stacked elements in bar chart?
Note that I have changed the solution completely after the discussion below. You may now change the color of any single bar-segm...

7 years ago | 1

| accepted

Load more