Answered
How do I change a 512*512 image code to any size code?
This should be a start % this presumes the image is uint8, so be careful % if you have IPT, you can use im2double() instead A...

5 years ago | 0

| accepted

Answered
nested if-else inside nested if-else
I don't have the same problem when I run it. There was some other issue though. img = rgb2gray(imread('sources/table.jpg')); ...

5 years ago | 0

| accepted

Answered
Make contour labels smaller?
It can be done, but it's a little awkward: % this is just some test data lat = 27.988056+(1:50); lon = 86.925278+(1:50); [la...

5 years ago | 1

Answered
Subtact one column of a cell array from another and put the result in the 3rd column
I'm going to assume those are all datetime values % make test array t1 = datetime('now','Format','HH:mm:ss'); t = t1 + minute...

5 years ago | 0

Question


In what version did certain colorbar properties change?
This is an exercise in a routine frustration; forgive me for letting it show. Someone has code which manipulates colorbar objec...

5 years ago | 1 answer | 0

1

answer

Answered
Grouping age data into 5 year bins
I'm going to just do this example starting with a numeric vector, but you can adapt it to use your table if you want. age = ran...

5 years ago | 0

| accepted

Answered
Sum alternaing columns of a matrix
Something like A = randi(9,3,10) a0 = sum(A,1) % show all column sums as an example a1 = sum(A(:,1:2:end),1) % odd col sums...

5 years ago | 1

| accepted

Answered
setting color scale of two datasets in the same axis in Matlab
It's certainly possible. It's not any fun, if you ask me. You can do it with overlaid axes. This post contains one example: ...

5 years ago | 1

| accepted

Answered
Adding images to reach a final composite.
By averaging, you're essentially extracting the BG, but not really in a way that would produce a BG estimate that's good for BG ...

5 years ago | 1

| accepted

Answered
How to extract 6 neasrest neigbors for particles
This can probably be improved, but this was what I did: A = [1 19 0.874004; 1 41 1.130905; 1 42 1.131306; 1 45 0.841402; ...

5 years ago | 0

| accepted

Answered
4d Array converting RGB image into binary
imshow(XTrain(:,:,2)) Is going to be a 4D monochrome image, which imshow won't like. I'm assuming you meant imshow(XTrain(:,:...

5 years ago | 0

| accepted

Answered
Plot the part of the cylinder x^2 + z^2 = 1 for y ≥ 0 , 0 ≤ z ≤ − y^2 + 1 . Can someone help me
This is a rather simple approach: n = 200; th = linspace(0,pi,n); x = linspace(-1,1,n); y = linspace(0,1,n).'; zc = rep...

5 years ago | 0

Answered
how to find the distance of all objects in given image
This will give an array mapping the distance from every object to every other object. You could reduce this with triu() if you ...

5 years ago | 0

| accepted

Answered
How to detecct specific circle and set values inside to 0
There are probably other ways to do this, but this is what I rolled: inpict = rgb2gray(imread('us2.bmp')); % generate a mask...

5 years ago | 0

| accepted

Answered
Filling array with dec2hex() value
Observe that the output of dec2hex() is a character array: x = 123 hx = dec2hex(x) gives x = 123 hx = '7B' So in ...

5 years ago | 1

| accepted

Answered
matlab words no help needed
What you're looking at isn't meaningful. It's all just rounding error. You're essentially doing this: y = sin(x) - sin(x); I...

5 years ago | 0

Answered
Decimal numbers problem on plotting
Consider: % make a simple plot that reproduces the fractional year ticks x = 2016:0.5:2020 plot(x,x) % get rid of tick lab...

5 years ago | 0

Answered
How to change the colors of the plotted lines in for loop?
You're flirting with disaster by doing this: col=['r' 'b']; % this is literally 'rb' As KSSV mentions, your first indexing ope...

5 years ago | 0

Answered
How to give a common title for the figure with subplots
You may want to try suplabel(). Suplabel() can provide overarching axis labels or titles for a group of subplots. https://www....

5 years ago | 0

| accepted

Answered
smoothing a curve efficiently
Since you haven't said what you actually attempted and haven't given any sample data or even revealed the domain and range of th...

5 years ago | 0

| accepted

Answered
How to get shades and tints of a color hex with Matlab?
There are a number of ways you could do it. The simple way would be to just interpolate between that color tuple and white (or ...

5 years ago | 1

| accepted

Answered
How to get the last two digits of a number?
Assuming they're integers: % 10 rows random integers n = (randi(8999,1,10)+1000)' n = [n mod(n,100)] If they aren't intege...

5 years ago | 1

Answered
add variable in the graph legend
I'm not sure what you're asking for, so I'll try a couple possibilities. If you want to put variable names in the legend text, ...

5 years ago | 0

| accepted

Answered
how to interpolate between two point of 1d time series data if the difference between any two consecutive point is greater than 25?
Maybe something like this: x = [5 10 36 20 17 5 51 60 40 13]; L = numel(x); fs = 4; t=0:1/fs:(L-1)/fs; idx = find(abs(dif...

5 years ago | 1

| accepted

Answered
Using CLI programs in Matlab
If this were *nix, you may be able to write an expect script to handle getting into and out of the other CLI program. man expe...

5 years ago | 0

Answered
numarical question interpolating polynomial code
% don't waste the user's time and invite error by making them % retype every single number every time the script runs x = 1.4:...

5 years ago | 0

Answered
tofloat and Paddedsize functions
tofloat() and paddedsize() are not Matlab functions in any toolbox I know of. If you found these in some code that you found so...

5 years ago | 1

Answered
program to reshape an array and perform some operations.
Your example is not working and leaves ambiguity. B-F are 1x16 vectors, and you're trying to reshape them to be 2x2. Besides n...

5 years ago | 0

| accepted

Answered
CLAHE wothout adapthisteq .
I know this is ancient, but I'm browsing and I put answers where the next person can find them. The ClipLimit parameter adjus...

5 years ago | 0

Answered
Is MathWorks working on a dark mode for MATLAB similar to what Visual Studio offers?
I've been using a workaround for years, and it is version-agnostic. The script is posted here, though you'll need to modify it ...

5 years ago | 3

Load more