답변 있음
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 ...

8년 초과 전 | 0

답변 있음
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...

8년 초과 전 | 1

| 수락됨

답변 있음
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...

8년 초과 전 | 0

답변 있음
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...

8년 초과 전 | 1

| 수락됨

답변 있음
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<...

8년 초과 전 | 0

답변 있음
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...

8년 초과 전 | 0

답변 있음
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...

8년 초과 전 | 0

답변 있음
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)

8년 초과 전 | 0

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

8년 초과 전 | 1

답변 있음
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'...

8년 초과 전 | 0

| 수락됨

답변 있음
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)

8년 초과 전 | 1

답변 있음
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...

8년 초과 전 | 0

답변 있음
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...

8년 초과 전 | 0

답변 있음
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...

8년 초과 전 | 1

답변 있음
Setting all the entry in multiple columns to zero
A(:,3:5)=0

8년 초과 전 | 0

| 수락됨

답변 있음
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...

8년 초과 전 | 1

| 수락됨

답변 있음
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...

8년 초과 전 | 0

답변 있음
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 ...

8년 초과 전 | 0

답변 있음
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...

8년 초과 전 | 1

| 수락됨

답변 있음
How can I make a vector of a repeating sequence
repmat([0 0 0 1],1,40)

8년 초과 전 | 6

답변 있음
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

8년 초과 전 | 0

답변 있음
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...

8년 초과 전 | 1

| 수락됨

답변 있음
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...

8년 초과 전 | 0

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

8년 초과 전 | 0

답변 있음
choose elements from a array with condition
extract=rowMatrix(10:10:1000)

8년 초과 전 | 0

답변 있음
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); ...

8년 초과 전 | 1

| 수락됨

답변 있음
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...

8년 초과 전 | 0

| 수락됨

답변 있음
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...

8년 초과 전 | 1

답변 있음
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...

8년 초과 전 | 0

더 보기