Community Profile

photo

Scott MacKenzie


Last seen: Today

York University

182 2020 年以降の合計貢献数

連絡する

Scott MacKenzie's バッジ

  • Revival Level 2
  • Knowledgeable Level 3
  • First Answer
  • Thankful Level 1

詳細を表示...

貢献した分野
表示方法

回答済み
How to choose the middle of a random cell in a 2D grid
This solution is simpler. It creates the grid using lines instead of a mesh. % x axis smin = 0; L = 4; ns = 25; s = lin...

約5時間 前 | 0

回答済み
Read elements on one side of matrix diagonal into a 1D array
There might be a tighter solution, but I think this achieves what you are after: a = magic(4) b = a'; c = logical(triu(ones(4...

約19時間 前 | 0

| 採用済み

回答済み
How do you write a nested if statement that checks if the user has entered certain numbers?
This is an example of input validation. Here's one method that achieves what you are after. The prompt is repeated until the u...

約22時間 前 | 1

| 採用済み

回答済み
Creating index and replacing values
Below is a loop solution. There might be a way to vectorize this -- not sure. A = [0 0 1 0 1 0 0]; B = [ "030121", "030221", ...

約22時間 前 | 0

回答済み
How to find multiple table column numbers by column names?
col_ind_rmt = find(string(G_Value.Properties.VariableNames) == "rk_mill_tonnage" | ... string(G_Value.Properties.VariableNa...

約24時間 前 | 0

回答済み
How to choose the middle of a random cell in a 2D grid
OK, thanks for the clarification. I think this achieves what you are after. The added code randomly chooses vertices (points) ...

1日 前 | 0

| 採用済み

回答済み
Customed distance function Haversine
You need to re-work your haversine function, as per the requirements for distance functions used with pdist2. There needs to be...

1日 前 | 0

回答済み
Verifying an Vector composition
There is probably an easier approach, but I think this works. The result of this expression is 1 if a1<a2<a3<a4<a5, or 0 otherw...

2日 前 | 1

回答済み
how can I sweep a triangle area using two loops
No need for loops. The tests are built in to the inpolygon function when you provide matrices as input. Assuming you want to f...

2日 前 | 0

回答済み
HOW TO FILTER AN HOUR DATA FROM ARRAY OF DAILY,MONTHLY AND YEAR DATA
T = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/658625/SAMPLE%20DATA.xlsx'); % combine DATE and...

3日 前 | 0

回答済み
How to duplicate cell array by rows?
n = handles.times; % your integer value newSequence = repmat(sequence, 1, n);

3日 前 | 0

| 採用済み

回答済み
integral of a matrix
You note: I want to take the integral of an exponetial of a matrix But, exp(-M.*t)*Dmat; is a vector, not a matrix. Tr...

3日 前 | 0

回答済み
Help rewritting textfiles in a certain way
This can probably be streamlined, but I think it achieves what you are looking for: % read the test data into a 1x1 cell and co...

4日 前 | 1

| 採用済み

回答済み
How to get row and column from a vector size
Assuming the vector length being a prime number (as noted by @the cyclist) is just one possible case of many, then the following...

4日 前 | 0

| 採用済み

回答済み
How to plot based on the shortest vector?
So, the approach I think you are willing to take is just to ignore the few extra elements that are in the longer of the two vect...

4日 前 | 1

回答済み
Best equation for Curve Fitting
How about r = .9999? Linear model Poly9: f(x) = p1*x^9 + p2*x^8 + p3*x^7 + p4*x^6 + p5*x^5 + p6*x^4...

4日 前 | 0

回答済み
How can a 4 element array index pull stored string values?
I think this is more or less what you are after. The output is generated both as a cell array and as a string vector. % create...

4日 前 | 1

| 採用済み

回答済み
Using System.DateTime in a Timetable
This converts the System.DateTime variable returned by netTime to a datetime variable, which can then be used with timetable: t...

4日 前 | 0

| 採用済み

回答済み
Change color of x axis and y axis barplot
I think this achieves what you are after. Note that plotyy is "not recommended". a = [rand(3,1)*100, zeros(3,1)]; b = [zeros(...

5日 前 | 0

| 採用済み

回答済み
Scatter Plot Legend Issue With Assignment
You only need to call the scatter function once. Re-organize your data, combining the values into a matrix. Then, you'll get ...

5日 前 | 1

回答済み
Do error bars affect confidence intervals?
You note: when I use the errorbar function in the code of the fit, it doesn't seem to change the confidence intervals The ...

5日 前 | 0

回答済み
Help with plotting data in a mat file
I think the error might be in how you are verifying your script. I ran your script and generated the plots. Here is what I see ...

5日 前 | 0

| 採用済み

回答済み
Changing prime numbers in a matrix
M = randi([1 50],100); M(isprime(M)) = 1415;

6日 前 | 0

回答済み
How to extract value from matrix in a cell array?
>> cell{1}(1,3) ans = 5

6日 前 | 0

| 採用済み

回答済み
Using a for loop to print function values
Seems you are confusing Vs with V. And what is VL-0.6 in your question? Try this... (outputs a vector of values) V = rand(1,1...

7日 前 | 0

| 採用済み

回答済み
How to find area under graph between two points ?
Assuming you want the area under the curve between two values of x (your "specific points"), here's what I put together using so...

7日 前 | 0

回答済み
How to extract data from an array?
t(700:1900) P(700:1900) Really, this is pretty basic stuff. I suggest you review Accessing Array Elements.

7日 前 | 0

| 採用済み

回答済み
Why is logical array fasle?
The result is false because k1 DOES NOT EQUAL g Note that both k1 and g are scalars, not vectors. Therefore, the result of k1=...

7日 前 | 0

回答済み
How to remove space between grouped bars in a bar graph?
Here's an approach that might be useful. What if you ungroup the data first? There will be no space between the groups, because...

7日 前 | 0

回答済み
saving files in a loop with different names
for k=1:20 ... filename = sprintf('info%d.dat', k); writematrix(M, filename); % data in M ... end

7日 前 | 0

Load more