Answered
How to mark a specific point in matlab plot?
To interpolate to find a value of x for a given value of y, treat y as the independent variable and x as dependent on y. x = 0:...

4 years ago | 0

| accepted

Answered
Getting mutliple lines into a legend from a for loop that provides different values
all_gamma = [0 0.5 1.5]; for gamma = all_gamma % your code end lgd = legend(sprintfc('2\\gamma = %d',2*all_gam...

4 years ago | 0

| accepted

Answered
Finding Upper and Lower Frequency Values in a Bode Plot
Since the magnitude of the frequency response decreases to its minimum value and then increases again, you can split it into two...

4 years ago | 1

| accepted

Answered
Converting a 100x3 matrix into a 100x30x3 matrix
X = (1:100).'+100*(0:2); % 100x3 matrix disp(X); Y = permute(repmat(X,[1 1 30]),[1 3 2]); % 100x30x3 array disp(size(Y)); di...

4 years ago | 0

| accepted

Answered
Continue running for loop for values that do not given an error
monthlyerrorsi = randn(100,20); % random monthlyerrorsi Mdl_vol(1) = egarch('GARCHLags',1,'ARCHLags',1); Mdl_vol(2) ...

4 years ago | 0

| accepted

Answered
UI doesn't show buttongroups but doesn't give any error
There are a couple of reasons why this is happening, both of which are related to the 'Units' of the components. First, when yo...

4 years ago | 1

| accepted

Answered
Replacing edited Data with New Data to Save to Text File in Appdesigner
My guess is that "ct" and "cr" are not the names of the columns/variables that readtable returns after reading the text file: %...

4 years ago | 0

| accepted

Answered
I have 200 by 4 matrix represents thicknesses and need to calculate the corresponding depths (will be also 200 by 4 matrix)
% a random 10-by-4 matrix of thicknesses % each element between 1 and 15: h = randi(15,10,4) % depth is cumulative sum along ...

4 years ago | 0

| accepted

Answered
Convert x and y coordinates from double to uint16
[x y] = ginput(1); x = uint16(x); y = uint16(y);

4 years ago | 0

| accepted

Answered
How to plot a family of squares and cubes given a vextex of each.
I won't claim it's the best way, but it works for any number of cubes: % first, squares for reference x=rand(1,10); y=rand(1,...

4 years ago | 1

| accepted

Answered
resize a matrix and missed data "zero"
% first matrix: A = [1 2 5; 80 50 60]; % these two lines of code work for a single matrix: new_A = [1:5; zeros(1,5)]; new_A(...

4 years ago | 0

| accepted

Answered
Getting the entry value (i,j) for the minimum value of reach row of a matrix
A=[11 13 15 12 14 16 32 18 21]; [minrow,idx] = min(A,[],2) % min value of each row, with column i...

4 years ago | 1

| accepted

Answered
Combine all columns of each slice in array as one column then convert it to 2D matrix
val(:,:,1) = [ -0.1031 -0.1163 0.1386 -0.9947 -0.9932 0.9903]; val(:,:,2) = [ -0.1030 -0.1127 0.1255...

4 years ago | 1

Answered
Array incompatible issue in for loop for plotting the small circles
Without knowing the intent of the code, it's hard to say how to fix it, but here's an attempt: clear all N=2; Lx=10; Ly=50...

4 years ago | 1

| accepted

Answered
How to add a row above the first row of a matrix to name each column
If I understand what you want to do, it is to add column headers "Tc", "Tf" and "Tr" to your numeric matrix t. Numeric arrays ca...

4 years ago | 1

| accepted

Answered
How to extract certain rows from an excel sheet based on two categorical value columns?
You can try this: T = readtable('196.xlsx','Sheet','196'); T(1:5,1:9); data = T(:,{'id','name','frame','speed','turn','accele...

4 years ago | 0

| accepted

Answered
How to search and log file locations of specific extension in a folder and its subfolders?
It's a little difficult to know exactly how to do it without knowing if there are any .aka files anywhere in "tank lab results" ...

4 years ago | 0

| accepted

Answered
Renaming Field Names of a Struct
If you want to rename the fields of a struct array, you can do so like this: S = struct('field_1',{1 2},'field_2',{3 4}) str =...

4 years ago | 0

Answered
Creating a nested loop
The resulting matrices have 4 rows because i goes from 3 to 4 and you use i as the row index when building the matrices. To hav...

4 years ago | 1

| accepted

Answered
How do I obtain a waveform of a note on MATLAB?
audioread returns a 100000 x 2 matrix because the file contains 100000 samples in each of 2 channels, i.e., it's a stereo record...

4 years ago | 0

Answered
How to plot .mat files in boxplot?
You mention an error, but I'm not sure if you mean you got an error message or just that the plot is not what you expected. If y...

4 years ago | 0

Answered
How to compare two arrays and logically replace elements to satisfy my condition
"replace values in array 1 with the value of array 2 if the array 1 value is greater than the value in array 2" % if array1 > a...

4 years ago | 1

| accepted

Answered
Pre Selecting Figures to plot
% some data you may or may not plot: F = randn(10,1); P = rand(20,1); D = randi(50,25,1); % prompt the plot selection: pl...

4 years ago | 1

Answered
How can I fill in the area between two curves? The curves are not the same length and also don't form a closed shape.
x1 = [1.0000; 3.0000; 4.5000; 6.0000; 8.0000; 11.0000; 16.0000; 20.0000; 25.0000; 30.0000]; x2 = [16.0027; 24.1943; 27.7769; 34...

4 years ago | 1

| accepted

Answered
What is wrong with my inputs for 'scatter3'?
% x, y, z similar to yours: x = datetime(1e4*rand(200,1)+7.2e5,'ConvertFrom','datenum'); y = rand(1,9); z = rand(9,200); % m...

4 years ago | 0

| accepted

Answered
divide the entries in the column by entries from another column
Use element-wise division ( ./ ) and you'll have it: AA = A(:,2) ./ ( A(:,2) + B(:,2) + C(:,2) + D(:,2) + E(:,2) )

4 years ago | 0

| accepted

Answered
Data coverage per cell of 3D array
% create a 3D matrix data with 15000 elements data = rand(15,10,100); % put NaNs at 7500 random indices (which may have repeat...

4 years ago | 0

| accepted

Answered
How to return value from one function within Function Matlab
Returning different sets of outputs from the function Stages, depending on the value of label % One way function varargout = S...

4 years ago | 0

Answered
extract small vector from large vector
b = [1;2;3;4;5;6;7;8;9;10;11;12;13;14;15]; a = zeros(3,1); c = [a; b] d = c(1:6,1) % ",1" not necessary since c only has one ...

4 years ago | 0

| accepted

Answered
Trying to create a random date using randi and if-elseif-else statements
To understand why your code gives you days = 31 every time, consider the following: % Case 1: seems to work ok month = 1; if ...

4 years ago | 1

Load more