Respondida
How to replace all elements that are not even integers?
A different way of doing it - generate a list of random integers much larger than the number you need, and pick out the subset ...

alrededor de 8 años hace | 0

Respondida
i want someone t explain it to me
kk iterates over the columns of the matrix There are two columns in the matrix so there will be two iterations of the loop. On t...

alrededor de 8 años hace | 1

| aceptada

Respondida
How do I find the first x value when y crosses a threshold and remains above the threshold for 5 consecutive data points
test=[1 2 3 4 3 4 5 6 4 3 3 4 5 10 8 6 4 4 7 6 8 9 10 4 4] threshold=4; index=test>threshold; startAt=regexp(char...

alrededor de 8 años hace | 0

Respondida
How does the for-cycle check its conditions?
From the docs: _Avoid assigning a value to the index variable within the loop statements. The for statement overrides any change...

alrededor de 8 años hace | 1

| aceptada

Respondida
Setting bounds on a calculated array
It's easy enough to index the places where the values in the vector are greater than 127 or less than 1 indices=charVector<...

alrededor de 8 años hace | 0

Respondida
Distribution of binary values
test=[1 1 1 0 0 1 1 1 1 1 0 0 0 0 1 1 0 1 0 1 1 0 0 0 0 1 1 0 1] out=regexp(char(test+48),'[0]+|[1]+','match') s...

alrededor de 8 años hace | 0

Respondida
Comment out the rest of the code
I suppose you could put in a double %% at line 100 to create a new section, and then just use the run section option on the prev...

alrededor de 8 años hace | 0

Respondida
how to concatenate numbers from multiple cells into a single number?
You could store it as a char string a=[1 0 0 0 0 1 1 0 1 0] b=char(a+48)

alrededor de 8 años hace | 0

Respondida
How can I remove the ranges from a specific column vector?
del=[1:4 9:12 13:16] k(del)=[]

alrededor de 8 años hace | 1

Respondida
can anyone help me to solve this problem?i want xor operation of 2 character arrays how to do xor operation of 2 character arrays?
a=['a' 'b' 'c'] b=['d' 'e' 'f'] c=bitxor(int32(a),int32(b)) If you expressly want the result as a char array you'...

alrededor de 8 años hace | 0

| aceptada

Respondida
concatenating vectors generated with loop
Not really more compact, but it does away with the loop N=10 output=reshape([ones(1,N); 1:N],1,2*N)

alrededor de 8 años hace | 1

Respondida
we have created one sparse matrix ,after that there is need to use one formula at the end,we got an error like undefined variable or function maximum but in the formula it s given like that ,plz help with this
Seems like you're calculating the maximum and minimum values with max(p4) and min(p4), but are not assigning them to the variabl...

alrededor de 8 años hace | 0

Respondida
choose n elements from array and increase sequentially
dummyMatrix=randi(50,1,100) result=zeros(1,91) for iter=1:91 %extract 10 element window extract=dummyM...

alrededor de 8 años hace | 0

Respondida
Index exceeds array bound help
On the last iteration of the loop z=91; you try to index z+1 (92) of array zz (which does not exist). On the last iteration of t...

alrededor de 8 años hace | 1

Respondida
Setting all the entry in multiple columns to zero
A(:,3:5)=0

alrededor de 8 años hace | 0

| aceptada

Respondida
I keep getting the error "Index exceeds array bounds". I've looked all over to no avail, please help.
At a guess, you initialize sounds with: %Sounds sound(1)={'bark'}; sound(2)={'meow'}; sound(3)={'neigh'}; sound...

alrededor de 8 años hace | 1

| aceptada

Respondida
Compare two vectors and assigning values then adding to a empty vector
result=hue2<hue1 Will return a logical vector with a 1 wherever hue2<hue1 and a 0 otherwise. If you want this as a double r...

alrededor de 8 años hace | 0

Respondida
How to generate all combinations of a vector
Generally, perms gives the permutations of a vector eg. >> perms([1 2 3]) ans = 3 2 1 3 ...

alrededor de 8 años hace | 0

Respondida
How can I create a new column in a table via if function?
By way of a smaller example - %Create dummy table for the purpose of example tbl=table() tbl.KW=(1:10)' %Copy...

alrededor de 8 años hace | 1

| aceptada

Respondida
How can I make a vector of a repeating sequence
repmat([0 0 0 1],1,40)

alrededor de 8 años hace | 6

Respondida
Can someone please help me with a loop issue.
E_=0:0.02:0.2 Values are indexed as E_(1), E_(2) and so on

alrededor de 8 años hace | 0

Respondida
Concatenate an unknown amount of strings to a master string.
The first thing you are doing in your while loop is setting the finalString to [] - so you lose everything you concatenate toget...

alrededor de 8 años hace | 1

| aceptada

Respondida
What can I do to display all the guesses that the user guessed at the end?
A=randi([1,N]); %Chooses random number between 1 and N %Create while loop for guesssing G=0; guesses=[] whil...

alrededor de 8 años hace | 0

Respondida
choose samples in for loop
You could use a step in your for statement i.e. for k=1:10:length(X)

alrededor de 8 años hace | 0

Respondida
choose elements from a array with condition
extract=rowMatrix(10:10:1000)

alrededor de 8 años hace | 0

Respondida
How to select one of the array and change the array data selected with another value ?
datasample=[83 84 82 81 82 86 81 85 87 88]; datasample(datasample==88) = mean(datasample); ...

alrededor de 8 años hace | 1

| aceptada

Respondida
storing loop function output in vector
y=Diff>=0 will return a logical array of all elements in Diff that are greater than or equal to 0. You can either just us...

alrededor de 8 años hace | 0

| aceptada

Respondida
How to display averages in new array?
B=[100.0000 100.0000 100.0000 100.0000 100.0000 100.0000 100.0000 100.0000 100.0000 100.0000 100.0000 100.0000 100...

alrededor de 8 años hace | 1

Respondida
Trying to do repeat math on multiple variables...
Fs = 44100; W_t = [0,150;150,600;600,1700;1700,7000;7000,22050]; W_r = W_t.*(2*pi/Fs) Is that what you want...

alrededor de 8 años hace | 0

Cargar más