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...

2 months 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 =...

2 months 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...

2 months 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...

2 months 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...

2 months 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 ...

2 months 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);

2 months 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_{...

3 months 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...

3 months 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; ...

3 months 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...

3 months 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...

3 months 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...

3 months 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...

3 months 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...

3 months 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'...

3 months 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...

3 months 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=...

3 months 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)...

3 months 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...

3 months 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 ...

3 months 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...

3 months 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 ...

3 months 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...

3 months ago | 0

Answered

How do I make a vector containing 30 cells that range from -5 to 45?

randi([-5 45],1,30)

How do I make a vector containing 30 cells that range from -5 to 45?

randi([-5 45],1,30)

3 months ago | 0

| accepted

Answered

How to remove rows with zeros in selected columns?

There is probably a simpler solution, but this will work... a = [ 1 0 5 0 6 2 0 0 0 0 3 3 5 9 12 4 0 0 0 0...

How to remove rows with zeros in selected columns?

There is probably a simpler solution, but this will work... a = [ 1 0 5 0 6 2 0 0 0 0 3 3 5 9 12 4 0 0 0 0...

3 months ago | 0

| accepted

Answered

Easiest way to create a line from 2 XY coordinates

MATLAB's hypot function is probably your best bet: M = [0 125.1673584 13.18046188 194.4534607 176.9597931; 1 126.4874725 ...

Easiest way to create a line from 2 XY coordinates

MATLAB's hypot function is probably your best bet: M = [0 125.1673584 13.18046188 194.4534607 176.9597931; 1 126.4874725 ...

3 months ago | 0

| accepted

Answered

Creating subset of table

Since column 1 contains numbers in cells, something like this is needed: T = array2table([{1, -2, 3}' {'a' 'b' 'c'}']) % test d...

Creating subset of table

Since column 1 contains numbers in cells, something like this is needed: T = array2table([{1, -2, 3}' {'a' 'b' 'c'}']) % test d...

3 months ago | 0

Answered

How to preform Anova + Tukey for within-subject design

I believe the issue is you've incorrectly specified the variable as the second argument in multcompare. Try tbl = multcompare(...

How to preform Anova + Tukey for within-subject design

I believe the issue is you've incorrectly specified the variable as the second argument in multcompare. Try tbl = multcompare(...

3 months ago | 0

Answered

Repeated measure ANOVA in MATLAB

What you have is a 2 x 4 within-subjects design. The independent variables are "Method" (2 levels) and "Case" (4 levels). You d...

Repeated measure ANOVA in MATLAB

What you have is a 2 x 4 within-subjects design. The independent variables are "Method" (2 levels) and "Case" (4 levels). You d...

4 months ago | 1

| accepted