Answered

How to rank data and set corresponsing values

Assuming the rankings are just used to explain your final goal, the following seems to work: M1 = [0.004130861 0.001492476 -0...

How to rank data and set corresponsing values

Assuming the rankings are just used to explain your final goal, the following seems to work: M1 = [0.004130861 0.001492476 -0...

7 meses ago | 0

Answered

How can I save the output figure into an image file?

A easy way is to use exportgraphics, introduced in R2020a: f = figure; imshow(...); exportgraphics(f, 'filename.jpg'); % or ....

How can I save the output figure into an image file?

A easy way is to use exportgraphics, introduced in R2020a: f = figure; imshow(...); exportgraphics(f, 'filename.jpg'); % or ....

7 meses ago | 0

Answered

Generate acoustic signal with difference rise time and fall time

Here's a simple approach that provides separate control for the rise or attack time (n1), the sustain time (n2), and the decay o...

Generate acoustic signal with difference rise time and fall time

Here's a simple approach that provides separate control for the rise or attack time (n1), the sustain time (n2), and the decay o...

7 meses ago | 0

| accepted

Answered

Store identical rows in specified column

This seems to answer your question. There are 41 uniques IDs in the second column of your data set. The code below extracts th...

Store identical rows in specified column

This seems to answer your question. There are 41 uniques IDs in the second column of your data set. The code below extracts th...

7 meses ago | 0

| accepted

Answered

Save marked point on plot

OK, this seems to to work. The x-y coordinates of the marked points are output to the command window (along with the figure num...

Save marked point on plot

OK, this seems to to work. The x-y coordinates of the marked points are output to the command window (along with the figure num...

7 meses ago | 0

| accepted

Answered

Save marked point on plot

Since you haven't provided any data or code, this is a rough answer only: [pks, locn] = findpeaks(-y, 'MinPeakProminence', 0.1)...

Save marked point on plot

Since you haven't provided any data or code, this is a rough answer only: [pks, locn] = findpeaks(-y, 'MinPeakProminence', 0.1)...

7 meses ago | 0

Answered

How to convert an excel file (.csv) to a .wav format/any other audio format file?

I was able to play your audio data and save it as a .wav file. It's some sort of noise along with a dripping sound. But, I had...

How to convert an excel file (.csv) to a .wav format/any other audio format file?

I was able to play your audio data and save it as a .wav file. It's some sort of noise along with a dripping sound. But, I had...

7 meses ago | 1

| accepted

Answered

how to easily and quickly change the variable names (headers) of multiple tables

For each table, it can be done like this: (To illustrate, this example is just for 5 columns) T = array2table(rand(3,5)); vn =...

how to easily and quickly change the variable names (headers) of multiple tables

For each table, it can be done like this: (To illustrate, this example is just for 5 columns) T = array2table(rand(3,5)); vn =...

7 meses ago | 0

Answered

How to assign Nans to specific column, not entire row

Your first attempt was almost correct. Here's the fix: ZB1array = rand(5,5) % test data idx = ZB1array(:,4) < 0.95; ZB1arra...

How to assign Nans to specific column, not entire row

Your first attempt was almost correct. Here's the fix: ZB1array = rand(5,5) % test data idx = ZB1array(:,4) < 0.95; ZB1arra...

7 meses ago | 0

| accepted

Answered

How to find the sum of characters in a cell array?

bowling= {{7,2,8,'/',6,2,'X',9,'/',9,0,'X','X',8,1,7,'/',9}, {'X',9, '/','X',8,'/','X','X',7,2,'X',8,'/',9,0}}; num_spares = su...

How to find the sum of characters in a cell array?

bowling= {{7,2,8,'/',6,2,'X',9,'/',9,0,'X','X',8,1,7,'/',9}, {'X',9, '/','X',8,'/','X','X',7,2,'X',8,'/',9,0}}; num_spares = su...

7 meses ago | 2

| accepted

Answered

Plotting periodic sawtooth wave with 25%, 50% and 75% duty cycle

I'm sure there are other (perhaps better) ways to do this, but I think the following code achieves what you are after: % create...

Plotting periodic sawtooth wave with 25%, 50% and 75% duty cycle

I'm sure there are other (perhaps better) ways to do this, but I think the following code achieves what you are after: % create...

7 meses ago | 0

| accepted

Answered

why is my plot only showing 1 diagonal line

First, you probably should move the plot functions outside the while loop. Build up the vectors, then plot! But, the reason ...

why is my plot only showing 1 diagonal line

First, you probably should move the plot functions outside the while loop. Build up the vectors, then plot! But, the reason ...

7 meses ago | 0

Answered

How can I draw a line with two points x1, y1 and x2, y2 and assign weight to the edge.

x1 = 0; x2 = 1; y1 = 0; y2 = 1; line([x1 x2], [y1 y2], 'linewidth', 5); text(0.45, 0.55, '10', 'FontSize', 14);

How can I draw a line with two points x1, y1 and x2, y2 and assign weight to the edge.

x1 = 0; x2 = 1; y1 = 0; y2 = 1; line([x1 x2], [y1 y2], 'linewidth', 5); text(0.45, 0.55, '10', 'FontSize', 14);

7 meses ago | 0

Answered

how to write equation in legend correctly in latex

MATLAB by default uses a subset of TeX. That's probably all you need: % test data a=1.2345; plot(rand(1,5)); legend(['t_{...

how to write equation in legend correctly in latex

MATLAB by default uses a subset of TeX. That's probably all you need: % test data a=1.2345; plot(rand(1,5)); legend(['t_{...

7 meses ago | 0

Answered

Subscript indices must either be real positive integers or logicals.

You've got some funny things going on with the S_x and S_y variables. I made a small change: building up the S_x and S_y values...

Subscript indices must either be real positive integers or logicals.

You've got some funny things going on with the S_x and S_y variables. I made a small change: building up the S_x and S_y values...

7 meses ago | 1

| accepted

Answered

How to draw a letter T ? the background is black and the letter itself white

Just add another white block for the top of the T: A = zeros(500, 500); A(100:200, 100:200) = 255; A(50:100, 50:250) = 255; ...

How to draw a letter T ? the background is black and the letter itself white

Just add another white block for the top of the T: A = zeros(500, 500); A(100:200, 100:200) = 255; A(50:100, 50:250) = 255; ...

7 meses ago | 1

| accepted

Answered

Decide values of row in matrix for certain row intervals

rows=150001;window=500; res=zeros(rows-window,4); flagstart = [11600 42410 72480 102100 132000]; flagend = [22620 52410 825...

Decide values of row in matrix for certain row intervals

rows=150001;window=500; res=zeros(rows-window,4); flagstart = [11600 42410 72480 102100 132000]; flagend = [22620 52410 825...

7 meses ago | 0

| accepted

Answered

Using fft to plot frequency spectrum of sum of rectangular pulses

I think this is what you are after. Mostly, this code just follows the example in the fft documentation, particularly w.r.t. ge...

Using fft to plot frequency spectrum of sum of rectangular pulses

I think this is what you are after. Mostly, this code just follows the example in the fft documentation, particularly w.r.t. ge...

7 meses ago | 1

Answered

Histrogram/bar chart plot problem

The code below uses your data and generates a bar chart similar to your sketch. I'm not sure how picky you are about the colors...

Histrogram/bar chart plot problem

The code below uses your data and generates a bar chart similar to your sketch. I'm not sure how picky you are about the colors...

7 meses ago | 0

| accepted

Answered

How to specify max. number of outliers on which to apply the Hampel filter?

There's probably a simpler way to do this, but I believe the code below achieves what you are after: % test data x1 = randi([5...

How to specify max. number of outliers on which to apply the Hampel filter?

There's probably a simpler way to do this, but I believe the code below achieves what you are after: % test data x1 = randi([5...

7 meses ago | 0

| accepted

Answered

Remove unwanted noise from scatter plot using Matlab

There are many ways to approach this, for example using smoothdata or rmoutliers. Both functions have options to control how th...

Remove unwanted noise from scatter plot using Matlab

There are many ways to approach this, for example using smoothdata or rmoutliers. Both functions have options to control how th...

7 meses ago | 0

Answered

How to Create a Surface Plot from Table Data Imported from Excel

Given some test data (attached) similar to yours... ... a surface plot can be created thus... M = readmatrix('testdata.xlsx'...

How to Create a Surface Plot from Table Data Imported from Excel

Given some test data (attached) similar to yours... ... a surface plot can be created thus... M = readmatrix('testdata.xlsx'...

7 meses ago | 1

| accepted

Answered

How to use separate locations for axis location and axis labels?

You don't need to set the x-axis location. Delete that line and then use yline to get a line at y = 0: figure time = [0 1 2 3...

How to use separate locations for axis location and axis labels?

You don't need to set the x-axis location. Delete that line and then use yline to get a line at y = 0: figure time = [0 1 2 3...

7 meses ago | 0

| accepted

Answered

How to draw sinewave with Scalling

Just shift the values in z up by constant... maxV=100; minV=5; f = 30; fs = 1e4; % samples per second t=...

How to draw sinewave with Scalling

Just shift the values in z up by constant... maxV=100; minV=5; f = 30; fs = 1e4; % samples per second t=...

7 meses ago | 0

Answered

shift matrix to the right

Perhaps this is what you are looking for: A=[0 0 1 1 0 0 1 1] B=[0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1] m = numel(A); n = numel(B)...

shift matrix to the right

Perhaps this is what you are looking for: A=[0 0 1 1 0 0 1 1] B=[0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1] m = numel(A); n = numel(B)...

7 meses ago | 2

Answered

Image plot with quiver vector overlain

quiver is drawing on top of the image. You haven't provided any data or code that can be executed, so it's hard to tell what th...

Image plot with quiver vector overlain

quiver is drawing on top of the image. You haven't provided any data or code that can be executed, so it's hard to tell what th...

7 meses ago | 0

Answered

How to read array from a text file into each row of a matrix.

OK, this should work. First, combine dir and pktFile using the fullfile function. Read the data using readtable, then restore ...

How to read array from a text file into each row of a matrix.

OK, this should work. First, combine dir and pktFile using the fullfile function. Read the data using readtable, then restore ...

7 meses ago | 0

Answered

Two way Repeated Measures ANOVA two different ways

@Mark Robinson The reason anovan and ranova give different results is that the within table in your solution using ranova is not...

Two way Repeated Measures ANOVA two different ways

@Mark Robinson The reason anovan and ranova give different results is that the within table in your solution using ranova is not...

7 meses ago | 1

| accepted

Answered

How to import .csv files, keeping all the headers (which are on multiples rows) in order to extract some information from the headers?

Assuming your files are consistently formatted, here's one way to extract the data values in the header lines and then read the ...

How to import .csv files, keeping all the headers (which are on multiples rows) in order to extract some information from the headers?

Assuming your files are consistently formatted, here's one way to extract the data values in the header lines and then read the ...

7 meses ago | 1

| accepted

Answered

Divide data in parts and plot them on a vertical line

From your description, this seems to work: M = [ 0.873615503511876 100 3.3; 0.902974727374816 100 3.3; 0.90067...

Divide data in parts and plot them on a vertical line

From your description, this seems to work: M = [ 0.873615503511876 100 3.3; 0.902974727374816 100 3.3; 0.90067...

7 meses ago | 0