답변 있음
Rearranging tables based on elements
For tables, an effective way to "transpose" (switch rows with columns, including variable names) is using the rows2vars function...

2년 초과 전 | 0

답변 있음
Finding student t critical value...
Here's demo code using tinv to produce the t-critical values for a two-sided test with independent samples (i.e., between-subjec...

2년 초과 전 | 0

답변 있음
How to draw a pulse train
It seems you want to replace the negative portion of the pulse with zeros. Like this, perhaps: fy=100; wy=2*pi*fy; duy=0.02;...

2년 초과 전 | 0

답변 있음
How to generate Pattern in MATLAB
Here's code to generate the patterns in the image posted: f = figure('color', 'w', 'Units','normalized','Position',[.25 .3 .4 ....

2년 초과 전 | 0

답변 있음
How do I make the movmean calculate the moving average at the start- and endpoints of an array but in conjunction to each other?
This seems to do the trick: A = [0 2 4 1 3 5 7]; M = movmean(A,[2 1]); M2 = movmean([A A A],[2 1]); n = numel(A); M2 = M2...

2년 초과 전 | 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...

2년 초과 전 | 0

답변 있음
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 ....

2년 초과 전 | 0

답변 있음
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...

2년 초과 전 | 0

| 수락됨

답변 있음
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...

2년 초과 전 | 0

| 수락됨

답변 있음
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...

2년 초과 전 | 0

| 수락됨

답변 있음
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)...

2년 초과 전 | 0

답변 있음
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년 초과 전 | 1

| 수락됨

답변 있음
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년 초과 전 | 0

답변 있음
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년 초과 전 | 0

| 수락됨

답변 있음
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년 초과 전 | 2

| 수락됨

답변 있음
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년 초과 전 | 0

| 수락됨

답변 있음
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년 초과 전 | 0

답변 있음
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년 초과 전 | 0

답변 있음
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_{...

2년 초과 전 | 1

답변 있음
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...

2년 초과 전 | 1

| 수락됨

답변 있음
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; ...

2년 초과 전 | 1

| 수락됨

답변 있음
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...

2년 초과 전 | 0

| 수락됨

답변 있음
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...

2년 초과 전 | 1

답변 있음
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...

2년 초과 전 | 0

| 수락됨

답변 있음
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...

2년 초과 전 | 0

| 수락됨

답변 있음
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...

2년 초과 전 | 0

답변 있음
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'...

2년 초과 전 | 1

| 수락됨

답변 있음
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...

2년 초과 전 | 0

| 수락됨

답변 있음
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=...

2년 초과 전 | 0

| 수락됨

답변 있음
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)...

2년 초과 전 | 2