Community Profile # Scott MacKenzie

### York University

Last seen: Today Active since 2020

#### Statistics

• • • • • • #### Content Feed

View by

Repeated measures ANOVA with two variables
Here's what I put together. None of the effects are statistically significant. See below. Were the data in the Value column ...

12 hours ago | 0

| accepted

How to use 'factorgap' to set larger gaps between groups of boxplot.
It is important to distinguish between a group and the members or elements of that group. The documentation on this point is poo...

1 day ago | 0

| accepted

Regression/ Ordinary Least squares on a custom equation
This is probably too simple to be correct, but I'll toss it out there anyway. Admittedly, I haven't considered anything you wri...

2 days ago | 0

Find a random position in a vector where the value is zero
% test data (includes zeros and imaginary numbers) A = [1i 4/1j 7 0 99 0 0 0 8*1j 0 0 0 8 9 0 -7 0]; % find indices of zeros...

3 days ago | 2

| accepted

matlab percentage always showing zero
Your code looks fine except for one problem. You need to build up the Er and Eb values in arrays. As is, you are overwriting E...

3 days ago | 0

Area under the curve ignoring axis values (Absolute area)
@Ganesh Naik Here's a new answer that uses ginput to "select" data points along the line for definiing the area of interest. Y...

3 days ago | 0

How can extract data in scatter plot??
% test data x = rand(1, 100); y = rand(1, 100); % find elements for class 1 (x is between 0 and 0.1) idx = find(x >= 0 & x...

3 days ago | 0

| accepted

Area under the curve ignoring axis values (Absolute area)
The trapz function uses integration so the result is the area under the curve. That's not what you want. I suggest you first c...

3 days ago | 0

| accepted

How to search closest coordinate values in a Lat Long Z data
You can do this with the pdist2 function. For latitude and longitude, usually the haversine method is used. Google it if you w...

4 days ago | 0

Using writetable in a for loop to create new txt/csv files for each step
Under the assumption your code is working fine except for the filename issue, here's what I suggest. Use this to create a new f...

5 days ago | 0

Question

Problem using ranova for analysis of variance
I'm trying to use ranova to analyse data from a fairly simple experiment, but am not successful as yet. The data (60x3) are att...

6 days ago | 1 answer | 0

### 1

How do I center my time-history plot at zero using code
Is the offset you are subtracting the mean of the values in the corresponding arrays? If so, just subtract the means: plot(t,x...

6 days ago | 0

| accepted

Find values in 3D matrix with given indices
Unless I'm missing something, this is just a simple matter of finding the indices corresponding to the latitude 77:81 elements a...

7 days ago | 0

Number of registered results by the number of total experiments in a pie chart
Here's one way to make the labels you want: % test data hEQ = [5 1 1 1 1 1]; % create labels for pie chart total = sum(hEQ...

7 days ago | 1

| accepted

How can I add confidence bounds to the plot?
Seems you are working with a linear model. Also, your attached plot is quite cluttered. It will get worse if you add confide...

8 days ago | 0

| accepted

Filter table based on time and make calculation
You don't need a loop. At a high level, here's what you need to do. Read the data into MATLAB, probably into a table using the...

8 days ago | 1

| accepted

Arrange the matrix by replace a part to another part
Assuming your matrices are conveniently sized... A1=ones(12); A2=ones(9)*2; A3=ones(6)*3; A4=ones(3)*4; A = A1; A(4:end,...

8 days ago | 0

| accepted

How to highlight a portion of time series on a plot?
Here's what I put together. I'm assuming you want 64 separate plots. % test data (timeseries) nRow = 64; % adjust as per yo...

9 days ago | 0

| accepted

Easiest way to load structure array from a text file
To save the data in the structure C in a file... save('savedata.mat', 'C'); To retrieve the data as a structure C later... lo...

11 days ago | 0

read 2 digits in a txt file using %f
If you examine the documentation for fscanf, it states that the correct formatSpec to use when reading floating-point numbers is...

12 days ago | 0

How to end loop after key is press
Here's an arrangement I've used with good success in the past. The loop executes indefinitely until a key is pressed. f = fi...

12 days ago | 0

| accepted

How to find the noisy signal using fourier transform for this data?
Here's what I put together. The input signal is somewhat noisy, but it is also periodic @ 34.4 Hz. f = 'https://www.mathworks...

13 days ago | 0

Save number of iterations in a for loop
@Rajvi AmleThis script shows one approach to plotting the results of your simulations. The data loaded are the t and x data col...

14 days ago | 0

how can i plot the amplitude spectrum of these signals
Do you want the FFT of the combination of the 20 Hz and 50 Hz signals? If so, then this might be the sort of plot you are after...

15 days ago | 0

How to remove NaN from 2 column vectors?
X = [2 4 8 NaN 13 NaN 3 6 NaN 38 40 11]; Y = [NaN NaN 2 NaN 10 67 1 NaN NaN 19 26 NaN]; nanLogical = isnan(X) | isnan(Y); X(n...

15 days ago | 0

| accepted

start to write for a specified location using fprintf
Here's a solution. Make sure you use "r+" when opening the file, otherwise you'll overwrite the first line. fid = fopen('testd...

16 days ago | 0

| accepted

start to write for a specified location using fprintf
fid = fopen('testdata.txt', 'w'); % change, as needed fprintf(fid, ' result_1 result_2\n'); fprintf(fi...

16 days ago | 0

Removing top and bottom outliers
Yes, the rmoutliers function will do the trick. After removing the top and bottom 5% of the values, the vectors below are reduc...

16 days ago | 0

| accepted