Answered
How to draw lines with the points obtained from getpts
You're getting 4 points, which you then plot with the line function. The name might sound like it only produces straight lines f...

7 years ago | 0

Answered
How do I map the data using interp1()?
I have no clue why you would want to do this, but the code below will treat the histogram as a lookup table. You need to convert...

7 years ago | 0

Answered
Using throw error to validate string input
if any(~x) error(msg) end

7 years ago | 0

| accepted

Answered
how to add to image ?
I would presume this means that you have an image where you add mean(X,'all') to the original. The loops are not needed in Matla...

7 years ago | 1

Answered
x-axis value
You x-axis exponent has me believe that you already have the correct range and that your goal is to show nanoseconds instead of ...

7 years ago | 0

| accepted

Answered
how can i change the xlim in bar?
You mean like this? set(gca,'XTick',ceil(1970:2.5:2005))

7 years ago | 0

| accepted

Answered
Displaying values in static box for values in pop up menu !!
There is a difference between the Value property and the String property. Also, you're better off using switch (which will make ...

7 years ago | 0

| accepted

Answered
How can i plot this kind of figure in Matlab ?
Looks like a bar plot and a line plot combined in one axis. Don't forget hold on when making this. For the second y axis you ca...

7 years ago | 0

Answered
An easy problem for you,propably
Matlab doesn't work with double conditions, so you need to use a setup like the one below if you want to keep your code structur...

7 years ago | 1

Answered
decimal place rounding off
Why not use the round function? You could use floor, ceil, or fix instead, but that would be cheating a bit. Anyway, you can u...

7 years ago | 0

Answered
How to add brightness slider in matlab gui that would change the second image's brightness?
You should probably be using something like this: function pushbutton1_Callback(hObject, eventdata, handles) [filename,pathnam...

7 years ago | 0

| accepted

Answered
Vectorizing a nasted loop
This should work: idx=reshape(1:(Chunks*Window),Window,Chunks); DataChunk=Raw.RAW(idx); TimeChunk=Raw.Time(idx); The output ...

7 years ago | 1

| accepted

Answered
Dimensions of matrices being concatenated are not consistent.
Your x vector is 6x1, while all other vectors are 5x1. Removing one element from that vector lets the code run without error: x...

7 years ago | 0

| accepted

Answered
How to add frame to image ?
Something like the code below should work. There are many ways to resize your image, below you'll find two examples. frame=imre...

7 years ago | 1

| accepted

Answered
How to randomly swap 2 elements in an array?
I'm going to assume at least one of the swap elements must be an number, and that the swapped numbers are allowed to have the sa...

7 years ago | 0

| accepted

Answered
Undefined function or variable
You don't define a, so it doesn't exist. But that is far from the only issue with your code. Also, why are you using j as a fun...

7 years ago | 1

Answered
calculate mean using while and iteration?
So you want to calculate these values? xn(1)=mean(b(a>0.5 & a<1.5)); xn(2)=mean(b(a>1.5 & a<2.5)); xn(3)=mean(b(a>2.5 & a<3.5...

7 years ago | 0

| accepted

Answered
Attempted to access x(2,1); index out of bounds because size(x)=[1,4].
The fsolve function requires a working function as input. Your function contains a few typos, and it assumes the input is a colu...

7 years ago | 0

Answered
How can I interpolate medians in a box plot?
You can probably extract the median value from the object boxplot creates, but you can also use the median function to find the ...

7 years ago | 0

Answered
Installing matlab 2019a 32 bit
Unfortunately, "x86-64" means '64 bit', not '32 or 64 bit'. Both your processor and OS must be 64 bit to have the 64 bit version...

7 years ago | 2

| accepted

Answered
how can I test and display how many values in a vector are contained in a pre-determined interval
Trivial with ismember: idx=[168 190 173 147 147 110 169 57 174 122 159 174 104 132]; T=160:192; in_T=ismember(idx,T); numb...

7 years ago | 1

| accepted

Answered
How to add distance lines between bar graphs in MATLAB?
I'm not aware of this functionality being implemented in the base Matlab. So if it is not in the FEX, you'll have to write it yo...

7 years ago | 0

Answered
how to generate random numbers with constraints?
The reason for your infinite loop is that you need an average random value of 150, which is far from the expected value of 402.5...

7 years ago | 2

Answered
User interface with GUI and callbacks working as interruption in a main function
You can use the callback of that second button to stop the continously looping timer function.

7 years ago | 0

| accepted

Answered
Saving a montage image
There is a difference between an image and an image object. The latter is a graphics object that is shown in the axes. It does c...

7 years ago | 4

| accepted

Answered
Replace Nan by a number in a cell array
You can use the isnan function: r = cell(sum(nL), numel(nL), numel(nW), max(nW(:))); for k = 1 : numel(nW) for m = 1 : nW...

7 years ago | 0

Answered
MATLAB command window on High DPI screens
right-click on the title bar of your command window (you can open a fresh one by using windows+R and entering cmd) go to proper...

7 years ago | 1

| accepted

Answered
How can I get the plot for a saved figure?
The line objects are probably in the Children property of your axes, which is itself a child of the figure (but so is the legend...

7 years ago | 2

| accepted

Answered
Determine which cells contain elements of another cell
A few calls to cellfun, a regexp and ismember will do the trick: fileNames = [{'.'}, {'..'}, {'1.bin'}, {'1_Report.txt'}, {'2.b...

7 years ago | 1

Answered
Add custom x and y axes (not relevant to the image)
The code below should help. You can specify tick labels that have nothing to do with the ticks themselves. %start out with a cl...

7 years ago | 0

| accepted

Load more