Answered
unique vector with restrictions
I suggest you read this post about why dynamically named variables are a bad idea. Instead, you'd be better off storing your vec...

26 days ago | 0

| accepted

Answered
Why do I get this error message "Array indices must be positive integers or logical values."
You have three distinct problems in this one line of code: Z = x.^2*y(y-1)*(y+1) One of them is causing the error you are seei...

27 days ago | 0

| accepted

Answered
I wish to move the tabs from the side, to up, please help
In your screenshot, see where there is a "View" tab along the top? Click that, and then use the "Tabs Position". This answer sh...

27 days ago | 0

Answered
Loop generation doubt.
% DO NOT USE THESE. USE YOUR DATA. THESE ARE FOR AN EXAMPLE ONLY T = rand(160547,1); A = rand(44880,1); k = rand(size(A)); w...

1 month ago | 0

| accepted

Answered
Loop generation doubt.
You don't need to use a loop. MATLAB will do vectorized calculations. If you have a fairly recent version of MATLAB, you can do...

1 month ago | 0

Answered
Can not make Legend border visible
There is a box around the legend by default, and I cannot remember that ever not being the case. Does this happen from a freshl...

1 month ago | 0

Answered
Extracting length information of pattern from specific string (not fixed string)
% Sample input str ="0101000000011010100000001101010000000110101000000011010100000001101010000000110101000000111110101"; % I...

1 month ago | 1

Answered
Extracting length information of pattern from specific string (not fixed string)
If 0101 is always at the beginning of the string, then % Example input str ="0101000011111111111111100000101010"; % The 8 d...

1 month ago | 1

Answered
Full distribution for 'b' coefficient when using coxphfit
I have a few thoughts. When you say "usually you get ...", do you mean from some other software package, specifically? Are you...

1 month ago | 0

| accepted

Answered
Indexing in a vector
Please see my comment. If your input is a vector (i.e. one-dimensional), then [maxValue indexToMaxValue] = max(inputVector);

1 month ago | 1

| accepted

Answered
how to plot boxplot of two matrix
There are likely a few different ways to do this task. Here is one straightforward way: A = rand(13,5); B = rand(9,5); xc =...

1 month ago | 0

Answered
multivariable regression, known structure, calculate coefficients
If you have the Statistics and Machine Learning Toolbox, you should be able to use the fitnlm function.

2 months ago | 0

Answered
Error: Unable to perform assignment because the left and right sides have a different number of elements.
In this line S(i+1) = S(i) + (s1 + 2*s2 + 2*s3 + s4)/6; the variables s1, s2, s3, and s4 are all row vectors with 300 elements...

2 months ago | 0

Answered
Using cellfun and regexp question
I think this does what you want. storedSamplerates{1} = 'SAMPLERATE: 50000'; storedSamplerates{2} = 'samplerate:200000'; ...

2 months ago | 0

| accepted

Answered
select random numbers from a group
I think I understand at least part of your question. Do you have the Statistics and Machine Learning Toolbox? If so, then to se...

2 months ago | 0

Answered
error in multiplication of array by a number
Just a guess here. If you have x = [0.2204 0.1897] and then type 1000*x in the command window, it will display [220.4 189.7]...

2 months ago | 0

Answered
Take mean value when elements inside array "clump up"
Assuming that my guess about the correct output is correct, then the following should work. % Original (sorted) data a = [1; 1...

2 months ago | 0

| accepted

Answered
Running code and getting error about vector must be the same length
It's the subtle difference between these two lines of code: xAK_val = [xAK-.5, xAK + .5, xAK + .5, xAK -.5]; yAK_val = [yAK-.5...

2 months ago | 1

| accepted

Answered
Why is Matlab 2019B not using python 3.6?
The following worked for me, per instructions in the documentation for pyenv. First, I ran pyenv with no argument, which told...

2 months ago | 0

Answered
Rectangular matrix manipulation with triu and tril
This will use the largest square matrix from the bottom right corner, as input to triu: d = min(size(A))-1; triu(A(end-d:end,e...

2 months ago | 1

Answered
Creating subvectors from a vector
reshape(X,[],4) See the documentation for reshape for details. The empty square brackets there indicate that MATLAB should infe...

2 months ago | 1

| accepted

Answered
How to convert a cell to matrix?
Here is one straightforward way: % Original data A={[1 3 4]; [2 5 6 4]; [2 6 8 9 5 6]; [3 6 5 4 1]}; %%%%%% Con...

2 months ago | 1

Answered
How to change two variables in one loop?
There are many things about your question that I don't fully understand. The least important is whether you meant the loop to go...

2 months ago | 0

Answered
Error using cd, Cannot CD
This code works for me when mfilename is a file that exists in my path, but otherwise it gives that error. So, my guess is that ...

2 months ago | 0

| accepted

Answered
Add new row to String Array.
You can preallocate memory for the entire string array with str = strings(200000,1); and then fill row-by-row rather than appe...

2 months ago | 1

| accepted

Answered
connect matlab to the cloud
Did you try to google "matlab amazon azure"? When I did, this link about using MATLAB in the Cloud was the first hit, and it has...

2 months ago | 0

Answered
Difference between errorbar and errorbarxy (function)
See this example from the documentation for errorbar.

3 months ago | 0

| accepted

Answered
Creating Global Stiffness matrix
If I've understood correctly, then K = zeros(8); vec1 = [1 2 3 4 7 8]; K(vec1,vec1) = K(vec1,vec1) + k1; vec2 = [5 6 7 8...

3 months ago | 1

Answered
Average of a column without including a certain number
There is no specific function for this, but it is easy to do without a loop: A = [6; 3; 6; 4]; N = 6; mean_A_without_N = mean...

3 months ago | 1

Answered
customize legend: extra legend entry
"The first item doesn't belong to any graph" immediately indicates to me that this text does not belong in the legend, for two r...

3 months ago | 0

| accepted

Load more