Answered

what does format short in a matlab code do??

It just changes the display format used when numbers are printed to console. format long pi format short pi There are othe...

what does format short in a matlab code do??

It just changes the display format used when numbers are printed to console. format long pi format short pi There are othe...

4 days ago | 0

| accepted

Answered

trying to store figures in an array, in a loop, instead of printing each figure

Since you're just using the gray colormap, there really isn't much that needs to be done. You can use mat2gray() to normalize t...

trying to store figures in an array, in a loop, instead of printing each figure

Since you're just using the gray colormap, there really isn't much that needs to be done. You can use mat2gray() to normalize t...

5 days ago | 2

Answered

while loop not working

This isn't exactly an elegant solution, but if we're gathering a bunch of parameters using input(), I think we've already crosse...

while loop not working

This isn't exactly an elegant solution, but if we're gathering a bunch of parameters using input(), I think we've already crosse...

5 days ago | 0

Answered

Select only determined rows in a matrix

Something like this. You'll have to adjust the starting index as needed: A = repmat((1:100).',[1 4]) % smaller example (100x4)...

Select only determined rows in a matrix

Something like this. You'll have to adjust the starting index as needed: A = repmat((1:100).',[1 4]) % smaller example (100x4)...

5 days ago | 0

Answered

Is it possible to use the colormap "Purples" in MATLAB, which maps zeros to white?

The answer is yes, but that's not really helpful. The real question is how do you get the colormap from matplotlib into MATLAB?...

Is it possible to use the colormap "Purples" in MATLAB, which maps zeros to white?

The answer is yes, but that's not really helpful. The real question is how do you get the colormap from matplotlib into MATLAB?...

5 days ago | 0

Answered

How to plot a matrix in a checkerboard style

Something like this should be a start: Im = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 1 0 0 ...

How to plot a matrix in a checkerboard style

Something like this should be a start: Im = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 1 0 0 ...

5 days ago | 2

| accepted

Answered

what does this mean in matlab code????

The expression ((floor(mr/2)==ceil(mr/2)) | (floor(mc/2)==ceil(mc/2))) conceptually says ((number of rows is even) OR (number...

what does this mean in matlab code????

The expression ((floor(mr/2)==ceil(mr/2)) | (floor(mc/2)==ceil(mc/2))) conceptually says ((number of rows is even) OR (number...

6 days ago | 0

| accepted

Answered

only masking part of image help

There's at least one thing going on here. This operation frame(755:933,206:388)<threshold will return a 179x183 logical image...

only masking part of image help

There's at least one thing going on here. This operation frame(755:933,206:388)<threshold will return a 179x183 logical image...

6 days ago | 1

| accepted

Answered

How to plot a different symbol and symbol line for each plot inside this loop?

I'm not sure why you're using a loop to create the same plots three times with different symbols. Are there other columns (of a...

How to plot a different symbol and symbol line for each plot inside this loop?

I'm not sure why you're using a loop to create the same plots three times with different symbols. Are there other columns (of a...

6 days ago | 0

| accepted

Answered

how to change colors of lines in a plot to exist on a scale

What exactly do you mean by "on a scale"? If what you're looking for is a means to have the line colors share a continuous colo...

how to change colors of lines in a plot to exist on a scale

What exactly do you mean by "on a scale"? If what you're looking for is a means to have the line colors share a continuous colo...

6 days ago | 0

Answered

Create rapid beeping tone in matlab

Depends how you want to do it. I bet there's lots of ways. I just made a piecewise signal and played it. fs = 8192; toned...

Create rapid beeping tone in matlab

Depends how you want to do it. I bet there's lots of ways. I just made a piecewise signal and played it. fs = 8192; toned...

6 days ago | 0

Answered

Undefined components in YCbCr color space

I know this is dead, but I'm bored on a slow Saturday. No, not in the same way. YCbCr is just a simple linear transformation o...

Undefined components in YCbCr color space

I know this is dead, but I'm bored on a slow Saturday. No, not in the same way. YCbCr is just a simple linear transformation o...

6 days ago | 0

| accepted

Answered

How to find a value in a matrix

Consider the simple example: % two orthogonal grids [x y] = meshgrid(linspace(0,1,10)) % the point you're trying to locate t...

How to find a value in a matrix

Consider the simple example: % two orthogonal grids [x y] = meshgrid(linspace(0,1,10)) % the point you're trying to locate t...

6 days ago | 0

| accepted

Answered

Integration with arbitrary constant

It depends if you want to do this numerically or symbolically % symbolically syms x a f = x-a; int(f,0,1) % answer is a func...

Integration with arbitrary constant

It depends if you want to do this numerically or symbolically % symbolically syms x a f = x-a; int(f,0,1) % answer is a func...

6 days ago | 0

| accepted

Answered

loop over all values in V

If this is the expression you're using % f is of the form A/I2 f = @(I2,V) (I_p - I_o*(exp((V+R_s*I2)./V_t)-1) - V + R_s*I2/R_...

loop over all values in V

If this is the expression you're using % f is of the form A/I2 f = @(I2,V) (I_p - I_o*(exp((V+R_s*I2)./V_t)-1) - V + R_s*I2/R_...

6 days ago | 0

Answered

multiscale retinex

This FEX submission is probably of interest: https://www.mathworks.com/matlabcentral/fileexchange/71386-multiscale-retinex Thi...

multiscale retinex

This FEX submission is probably of interest: https://www.mathworks.com/matlabcentral/fileexchange/71386-multiscale-retinex Thi...

6 days ago | 0

Answered

Convert RGB to HSI

Yes, it makes a difference. Compare the results for HSI, HSL and HSV: R = [ 120 20 30; 170 20 70; 120 140 70 ]; G =...

Convert RGB to HSI

Yes, it makes a difference. Compare the results for HSI, HSL and HSV: R = [ 120 20 30; 170 20 70; 120 140 70 ]; G =...

6 days ago | 0

| accepted

Answered

Save mean values in additional column

Something like this % dummy data N = 15; Range1peaks = [10*rand(N,1)-70 2*rand(N,1)+4 randi([0 5],N,1)] % sort [~,Peaks_ind...

Save mean values in additional column

Something like this % dummy data N = 15; Range1peaks = [10*rand(N,1)-70 2*rand(N,1)+4 randi([0 5],N,1)] % sort [~,Peaks_ind...

6 days ago | 0

Answered

Images stored in a cell array are getting cut off

Whatever your processImage function is returning, it's not 1024x1344 raster data. I doubt it's getting cut off either. It's a ...

Images stored in a cell array are getting cut off

Whatever your processImage function is returning, it's not 1024x1344 raster data. I doubt it's getting cut off either. It's a ...

6 days ago | 0

Answered

How to split a vector into 2 vectors, that one holds the evens and one hold the odds

Something like this will extract the contents of odd/even indices: V = 1:10; odds = V(1:2:end) evens = V(2:2:end) Note that'...

How to split a vector into 2 vectors, that one holds the evens and one hold the odds

Something like this will extract the contents of odd/even indices: V = 1:10; odds = V(1:2:end) evens = V(2:2:end) Note that'...

6 days ago | 1

| accepted

Answered

How can I use the solve command in Matlab to find the intersection of two equations?

Something like this: % solve system of equations syms x y eqn1 = x^2 + y^2 == 9; eqn2 = 2*x + 3*y == 4; S = solve([eqn2 e...

How can I use the solve command in Matlab to find the intersection of two equations?

Something like this: % solve system of equations syms x y eqn1 = x^2 + y^2 == 9; eqn2 = 2*x + 3*y == 4; S = solve([eqn2 e...

7 days ago | 0

Answered

How to select several intervals from a vector?

Idk. Here's three ways. They all use loops. Is there something more elegant? Prrrrobably. Is it faster? Probably depends. ...

How to select several intervals from a vector?

Idk. Here's three ways. They all use loops. Is there something more elegant? Prrrrobably. Is it faster? Probably depends. ...

7 days ago | 0

Answered

when making array of several sound signals, it doesn't give correct sounds when indexing each element

Something like this keys = '8675309'; toneduration = 0.4; spaceduration = 0.1; fs = 8000; sourcetones = [697 770 852 941...

when making array of several sound signals, it doesn't give correct sounds when indexing each element

Something like this keys = '8675309'; toneduration = 0.4; spaceduration = 0.1; fs = 8000; sourcetones = [697 770 852 941...

7 days ago | 0

| accepted

Answered

Remove the repetitive items in matrix

You're using solve to solve two independent equations as if they were a system, and solve is accordingly returning a set of poin...

Remove the repetitive items in matrix

You're using solve to solve two independent equations as if they were a system, and solve is accordingly returning a set of poin...

7 days ago | 0

| accepted

Answered

top- hat transform for signal processing

The tophat and bottomhat operations are the difference of the source image and the opening/closing of said image with the select...

top- hat transform for signal processing

The tophat and bottomhat operations are the difference of the source image and the opening/closing of said image with the select...

7 days ago | 0

Answered

Please let me know a way to use for loop to extract the first row elements from each column of data and check a condition and store these in a matrix

Something like this C = {'f' 'm' 'f' 'female' 'male'; '5.9' '6' '172' '' '180' }; g =...

Please let me know a way to use for loop to extract the first row elements from each column of data and check a condition and store these in a matrix

Something like this C = {'f' 'm' 'f' 'female' 'male'; '5.9' '6' '172' '' '180' }; g =...

7 days ago | 0

Answered

I need some help with a mathlab project

Use a while loop. Switch-case is more concise. x = 0; while true fprintf('x is currently %d \n',x) uresp = input('...

I need some help with a mathlab project

Use a while loop. Switch-case is more concise. x = 0; while true fprintf('x is currently %d \n',x) uresp = input('...

7 days ago | 0

Answered

sorting a cell array

Something like this: C = {3,1,6,[2,6,7],[4,10],10}; % don't call it 'cell' [~,idx] = sort(cellfun(@(x) x(1),C),'ascend'); C =...

sorting a cell array

Something like this: C = {3,1,6,[2,6,7],[4,10],10}; % don't call it 'cell' [~,idx] = sort(cellfun(@(x) x(1),C),'ascend'); C =...

7 days ago | 0

| accepted

Answered

Setting the color of specific cells in a heatmap that contains two types of data

You can use NaN to indicate out-of-range data h = rand(10,10); h(h<0.1) = NaN; hh = heatmap(h); hh.MissingDataLabel = 'h <...

Setting the color of specific cells in a heatmap that contains two types of data

You can use NaN to indicate out-of-range data h = rand(10,10); h(h<0.1) = NaN; hh = heatmap(h); hh.MissingDataLabel = 'h <...

7 days ago | 0

| accepted