Respondida
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...

alrededor de 6 años hace | 0

Respondida
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...

alrededor de 6 años hace | 0

| aceptada

Respondida
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...

alrededor de 6 años hace | 0

| aceptada

Respondida
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; ...

alrededor de 6 años hace | 0

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

alrededor de 6 años hace | 1

Respondida
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) ...

alrededor de 6 años hace | 2

| aceptada

Respondida
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...

alrededor de 6 años hace | 0

Respondida
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.

alrededor de 6 años hace | 0

| aceptada

Respondida
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...

alrededor de 6 años hace | 1

Respondida
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...

alrededor de 6 años hace | 0

Respondida
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...

alrededor de 6 años hace | 0

Respondida
I am trying to create an if/else staement over a range of values and display the corresponding value for each values variable. Ex if a<5 then c=2 b=1 else c=3 b=4 but over a range of a values displaying each c or b value for each of the a values
It is not 100% clear to me what you want to do, however you can use elseif for multiple statements: a=5; if a==4 else...

alrededor de 6 años hace | 0

| aceptada

Respondida
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...

alrededor de 6 años hace | 0

| aceptada

Respondida
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...

alrededor de 6 años hace | 1

| aceptada

Respondida
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...

alrededor de 6 años hace | 0

Respondida
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;...

alrededor de 6 años hace | 0

Respondida
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); ...

alrededor de 6 años hace | 1

Respondida
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...

alrededor de 6 años hace | 0

Respondida
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...

alrededor de 6 años hace | 0

| aceptada

Respondida
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...

alrededor de 6 años hace | 1

| aceptada

Respondida
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...

alrededor de 6 años hace | 0

Respondida
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...

alrededor de 6 años hace | 1

Respondida
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...

alrededor de 6 años hace | 0

Respondida
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 ...

más de 6 años hace | 1

Respondida
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...

más de 6 años hace | 0

| aceptada

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

más de 6 años hace | 0

| aceptada

Respondida
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...

más de 6 años hace | 0

Respondida
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 ...

más de 6 años hace | 0

| aceptada

Respondida
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...

más de 6 años hace | 0

| aceptada

Respondida
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...

más de 6 años hace | 4

| aceptada

Cargar más