Answered
Error using vertcat Dimensions of arrays being concatenated are not consistent.
data3 = [data1 data2] will concatenate them horizontally rather than vertically. You can do that, because they have the same nu...

5 years ago | 0

| accepted

Answered
build an array y depending on x
You have a few problems to fix: As you can see in its documentation, the input function requires you to include some prompting ...

5 years ago | 0

Answered
Unique numbers, not ordered
I believe this does what you want: X1 = [1 23 36 45 47 2]'; X2 = [1 36 47 2 6 ]'; X3 = [1 22 23 47 2 4]'; ...

5 years ago | 0

Answered
Input from PCA to train in SVM
I have written a "tutorial" on how to use and interpret MATLAB's pca function here. Lots of users have asked questions (some of ...

5 years ago | 0

| accepted

Answered
Assign a label to a point of a matrix in if statement
By default, Kappa_j is going to be a numeric array, and there cannot accept character input. Instead, you could define it as a c...

5 years ago | 1

| accepted

Answered
Subtraction of set value from specific elements in column once criteria met
threshold = 5000; % Set this to the limit value you want x(x>threshold) = x(x>threshold) - 65535;

5 years ago | 0

| accepted

Answered
calling script in another script
This question and answer should help you.

5 years ago | 0

Answered
Binary Logistic Regression - beginner
If you have the Statistics and Machine Learning Toolbox, you can use the fitglm function to fit a binomial logistic regression. ...

5 years ago | 1

| accepted

Answered
conversion double to array
If you want your 34x1 double to be in a single cell of a cell array, then ... inder = rand(34,1); inderCell1 = {inder} If you...

5 years ago | 0

| accepted

Answered
Reproduce a best-fit 4-parameter sigmoid
It is difficult when you say you have no idea. But, here are a few thoughts. If you have never used MATLAB at all, then you hav...

5 years ago | 0

Answered
the "taylor" function does not work for me (beginner)
In the assignment statement for T3, you capitalized "Taylor". MATLAB is case-sensitive, so you must use "taylor".

5 years ago | 2

Answered
Iterator goes infinite when changing step from 1 to 0.1
It's difficult to follow exactly what it going on in your code. I haven't traced the logic completely, but I figured out that wh...

5 years ago | 0

| accepted

Answered
Shorten the values from a column in another column.
The specific solution is potentially very dependent on ... the input format -- there are several way to read in Excel, leading ...

5 years ago | 0

| accepted

Answered
Operations with function handles / anonymous functions
Is this what you want? function1 = @(x) x(1)^2+5 function2 = @(x) 2*x(2) function12 = @(x) function1(x) + function2(x)

5 years ago | 1

| accepted

Answered
Shorten the values from a column in another column.
If these are numeric values, I think maybe you can do output_values = unique(floor(input_values)); But see my comment above, f...

5 years ago | 0

Answered
Covariance matrix as a diagonal matrix or not??????
I am definitely not an expert in this, but my guess is that these statements might only be strictly true for signals of infinite...

5 years ago | 0

Answered
summing columns based on certain interval
The best answer will depend on what specifically you want the output to be, and also how generalizable the solution needs to be....

5 years ago | 0

| accepted

Answered
How to delect the zero values in table
If all of the table entries are numeric, then this will work: % Create an example input table x = [0; 1; 0; 2]; y = [0; 1; 0;...

5 years ago | 0

| accepted

Answered
Exponent error calculating integral.
I expect you want phi.^3 instead of phi^3 inside your function fun

5 years ago | 0

Answered
How to generate a sparse matrix for a given array?
Here is one way: A = [1 3; 1 4; 2 3; 2 5; 3 5; 4 5]; d = max(A(:)); B = sparse(A(:,1),A(:,2...

5 years ago | 1

Answered
Assign rank to values in a matrix
Here is one way. (I did a smaller array, so the result is easier to verify.) % Set random seed for reproducibility rng default...

5 years ago | 1

| accepted

Answered
use mvnrnd with some conditions
Let's take this small example in which we generate just 3 pairs of correlated random numbers: n=3; % Generate 3 pairs, instead ...

5 years ago | 0

Answered
change variable in function_handle
I think this is what you mean? % Define f f=@(x) sin(x); % Derive g from f g = @(x) f(x+2); % Show that it gives expected r...

5 years ago | 0

| accepted

Answered
How to change legends' name
Here is a basic way you can do it: N = 3; figure hold on for ii = 1:N plot(rand(1,7),'DisplayName',sprintf('Theta %d'...

5 years ago | 0

| accepted

Answered
I want answer b for all value of N but it only read for latest value of N and value b become zero for 1st and 2nd of N. How i fix this problems?
I think you want b = (a*A*f)./(pi*Dm*N); I suggest you read Array vs. Matrix operations.

5 years ago | 0

| accepted

Answered
How do you load m-files that contain filenames with integers and strings?
Use the %d notation, and a cell array for storing: for ii = 1:50 B{ii} = load(sprintf('TTsim%dVariable.mat',ii)); end

5 years ago | 0

Answered
Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.
In this line: k0(i)=0.378893+1.4897153*w-0.17131848*w.^2+0.0196554*w.^3; w is a 2-element vector, and you are trying to assign...

5 years ago | 0

| accepted

Answered
Extracting data from two tables with the same ID's
I didn't completely follow what you are trying to do, but I'm pretty sure you should be able to use the join command to do what ...

5 years ago | 1

| accepted

Answered
Scatter Plot: X and Y must be vectors of the same length
SDT=[8702.28,7733.86,9790.18,5877.4,6690.84,6281.96,7846.98,5875.71,8098.65,6026.58,5885.59,4080.97,4940.49,4204.46,4451.12,5826...

5 years ago | 0

| accepted

Answered
Changing array elements relative to it's size and position in the array
I think this does what you want: % Original data R = [0, 0, 4, 0, 1, 0, 0, 0, 0, 6]; % Identify the non-zero elements of R ...

5 years ago | 0

| accepted

Load more