Answered
For loop with Else statement
My guess is that you want to set every value in RR to 0 after the cumulative sum reaches 3000. Here is why this does not work...

7 years ago | 0

Answered
If statement with many logical or.
You are comparing floating point numbers, which will not necessary work: 1-0.4-0.2==0.4 ans = 0 You c...

7 years ago | 0

| accepted

Answered
Index in position 1 exceeds array bounds (must not exceed 4079). how to rectify this error
You are passing Hist and testIDs to your cal_AP function. In that function your try to access Hist(tesIDs). Hist has 4079 row...

7 years ago | 0

| accepted

Answered
For the code below how would I make it ALWAYS select and set the upper left corner to be 1 always no matter what the n value is (10, 1000, 1000000)?
I am only guessing, but i assume you want nodetype(1,1) to be 1? The easiest way of doing this would be: nodetype(1,1)=1; ...

7 years ago | 0

Answered
use logical indexing to access multiple lines syntax
Almost there ;) in p you have the row positions: p552r1kmeans=p552r1_tnL(p,1:3)

7 years ago | 1

Answered
Problem with quiver plot function
You got a typo: Qplot(handles.edit22.String, h.latf, h.lonf, h.uf. h.vf, handles.edit21.String, handles.edit23.String) ...

7 years ago | 2

| accepted

Answered
Conditional with string wildcard
You should get a warning that Text1 ='Tree'*; is no valid syntax (the * is a problem). If you want to use * as a wildc...

7 years ago | 0

Answered
Loop is not working. My while loop is not working. output is initial values here. Can anyone help??
C is not a vector/matrix it is a scalar. C(counter) can not work for any value of counter >1. C(0.1) will not work either.

7 years ago | 0

| accepted

Answered
Subscript indices must either be real positive
The error is actually not that straight forward. Many floating point numbers can described 100% accurate in binary form. So your...

7 years ago | 1

Answered
How are multiple for loops handled by matlab?
This depends on how you nest your loops: for k=1:100 for n=[10,50,70] %this is the inner loop it will be executed 100 t...

7 years ago | 0

Answered
Changing the matlab seed
You can use rng('shuffle') For more information have a look <https://de.mathworks.com/help/matlab/math/why-do-random-nu...

7 years ago | 0

Answered
Iteratively wants to change column while reading MS-Excel sheet
I recommend to use xlsread just once to retrieve all your data. They will already be stored in a neat cell structure ready to be...

7 years ago | 0

| accepted

Answered
How can I give user defined Yes No for multiple set of code?
a=input('Do you like triangles? Y/N','s'); if strcmpi(a,'y') %triangles elseif strcmpi(a,'n') %no trian...

7 years ago | 1

| accepted

Answered
why i cannot genereate the answer?
I agree with Stephen and Guillaume that else if should be elseif instead. I'd like to point out that there is another problem...

7 years ago | 0

Answered
How do i use a pair of nested for loops to store a series of 9 related numbers in a 3x3 matrix?
I hope i got the question right (some possible solutions with increasing number of loops): %no loop a=1; b=1;...

7 years ago | 0

Answered
how to sum a vector without sum function
If the only requirement is to not use _sum_, i'd like to suggest to use _cumsum_ instead! A=cumsum(StrengthVector); ...

7 years ago | 1

Answered
Recreating a figure from its handle after it has been closed
You can change the CloseRequestFcn of your figure to turn your figure invisible rather than closing it. As long as you keep your...

7 years ago | 0

Answered
problem with coding cumsum statement
Your data are stored as cells, not as matrix. Your values are also strings and need to be cast to numbers first. This code might...

7 years ago | 0

| accepted

Answered
Create a GUI (which aim to show and change a list of variables) dynamically based on the number of variables
As Stephen already pointed out this becomes way easier if you index your structure. %creating 'Variables' Variables(1).v...

7 years ago | 1

| accepted

Answered
I want to have a sequence of vectors using the following loop. but when i run the mat lab it will say "Subscripted assignment dimension mismatch." what can i do to index vectors and matrix.
There are a few errors in your code: # You try to assign 3 values [1 4 6] to only one field in x. This will not work unless x...

7 years ago | 0

Answered
For Loop Moving Through Array
You overwrite A in every iteration and you are calculating the same value over and over again (not using N anywhere). I am no...

7 years ago | 1

Answered
Export to Excel from MATLAB GUIDE GUI (user defines filename and directory)
Every function has its own workspace. Your function does not know x_data, y_data, accel_data and velocity_data. There are severa...

7 years ago | 0

Answered
why not it work between 1 and 10?
I think it is unlikely, that one number is smaller than 1 and bigger than 10 at the same time. num = input('enter a number ...

7 years ago | 1

Answered
Help needed with the program
As Kalyan Acharjya has already shown the actual error is a wrong parenthesis. if(M == 1 && D ==1) || (M == 7 && D == 4...

7 years ago | 0

| accepted

Answered
Matrix dimensions must agree error
I hope i understood your code right, this might help: t = sample.VarName1; X = sample.VarName2; indexOfComments = fin...

7 years ago | 0

| accepted

Answered
Writing key presses and time point of presses to file
This should work for numbers and letters, avoid space,cr,tab ... It also overwrites your old file if you don't change the fil...

7 years ago | 0

Answered
How to fix error index exceeds matrix dimensions. I am very new to matlab and am trying to write a loop for this data set but I keep getting this error. Any help would be appreciated!
You remove rows of Data, thus its size is shrinking during your loop. One way to resolve this is removing those rows after your ...

7 years ago | 0

| accepted

Answered
I want only one value stored in this code
Does v actually contain negative values? Else every value in s will be greater 4 after it exceeds this threshold for the first t...

7 years ago | 0

| accepted

Answered
App Designer: How to open a second GUI or a new window with panels, lamps, edit fields, etc. by a ButtonPush callback ?
You can create a 2nd app with appdesigner and call it from your first app. Your callback should look like this: function b...

7 years ago | 4

| accepted

Load more