답변 있음

overly convoluted elseif condition

You can replace all of them with a single statement and indexing. if x>=1 & x<=4 y = p(x); else y = 1; end

overly convoluted elseif condition

You can replace all of them with a single statement and indexing. if x>=1 & x<=4 y = p(x); else y = 1; end

4일 전 | 0

| 수락됨

답변 있음

How to increment matrix row only inside a nested for loop?

The solution is indexing. You can do math in your index if you need to. x((i-1)*5+j) = i*j;

How to increment matrix row only inside a nested for loop?

The solution is indexing. You can do math in your index if you need to. x((i-1)*5+j) = i*j;

12일 전 | 0

답변 있음

filtering data with a for loop and plot only filtered data

This can be done much more simply with logic indexing. quer = meas.ay.data; quer = quer(quer > 1.5 | quer < -1.5); plot(quer)...

filtering data with a for loop and plot only filtered data

This can be done much more simply with logic indexing. quer = meas.ay.data; quer = quer(quer > 1.5 | quer < -1.5); plot(quer)...

14일 전 | 1

| 수락됨

답변 있음

Replace values in collumns

You can just index your matrix to reorder it, assuming all of the columns are the same type of data (i.e. all of column 6 is z2,...

Replace values in collumns

You can just index your matrix to reorder it, assuming all of the columns are the same type of data (i.e. all of column 6 is z2,...

15일 전 | 0

답변 있음

2 variable for-loop

The issue is with your definition of test. Nested for loops are totally fine. test(:,ss)=TKE_dave(:,ss); On your last loop te...

2 variable for-loop

The issue is with your definition of test. Nested for loops are totally fine. test(:,ss)=TKE_dave(:,ss); On your last loop te...

15일 전 | 1

| 수락됨

답변 있음

Error Unable to perform assignment because dot indexing is not supported for variables of this type.

You are receiving the error because you have already defined the class of the first level as a character. In order to add a seco...

Error Unable to perform assignment because dot indexing is not supported for variables of this type.

You are receiving the error because you have already defined the class of the first level as a character. In order to add a seco...

20일 전 | 0

| 수락됨

답변 있음

Changing Variable in matrix

Why are you originally defining A as A = [a b c]? This isn't very common or efficient matlab usage. I would suggest starting wit...

Changing Variable in matrix

Why are you originally defining A as A = [a b c]? This isn't very common or efficient matlab usage. I would suggest starting wit...

20일 전 | 0

답변 있음

Could someone please optimize this code?

I don't know about 'optimized,' but I'm pretty sure you can remove the entire for loop by vectorizing. Also, suppressing your va...

Could someone please optimize this code?

I don't know about 'optimized,' but I'm pretty sure you can remove the entire for loop by vectorizing. Also, suppressing your va...

22일 전 | 0

답변 있음

How can I assign a variable to all the columns and all the rows of a matrix?

You don't need to actually create a new variable for this, you can just use the results from size. A = randi(100,20,10); [r,c]...

How can I assign a variable to all the columns and all the rows of a matrix?

You don't need to actually create a new variable for this, you can just use the results from size. A = randi(100,20,10); [r,c]...

26일 전 | 0

답변 있음

A for loop with matrix as step

I'm confused what you're trying to do. From the psuedo code you wrote it looks like you're trying to loop through each of the a...

A for loop with matrix as step

I'm confused what you're trying to do. From the psuedo code you wrote it looks like you're trying to loop through each of the a...

약 1달 전 | 0

답변 있음

Choose a cell array that satisfy better some criteria

Ok, here is what I have come up with. It will probably still need some tweaking, but you should be most interested in the calcul...

Choose a cell array that satisfy better some criteria

Ok, here is what I have come up with. It will probably still need some tweaking, but you should be most interested in the calcul...

약 1달 전 | 0

| 수락됨

답변 있음

Is the find function a robust method to determine the number of specific values in a Matrix?

That method will certainly work, and I would generally use the same concept. I would just use the sum command though to avoid th...

Is the find function a robust method to determine the number of specific values in a Matrix?

That method will certainly work, and I would generally use the same concept. I would just use the sum command though to avoid th...

약 1달 전 | 1

| 수락됨

답변 있음

can any one explain this line of the code.

Per matrix math rules, when you add a single value to a matrix, that operation is applied to all values of the matrix individual...

can any one explain this line of the code.

Per matrix math rules, when you add a single value to a matrix, that operation is applied to all values of the matrix individual...

약 1달 전 | 0

| 수락됨

답변 있음

Find all the words contained in a file and make an index

You are on the right track, but you aren't calling the word index correctly. Also, I would suggest using strfind instead of the ...

Find all the words contained in a file and make an index

You are on the right track, but you aren't calling the word index correctly. Also, I would suggest using strfind instead of the ...

약 2달 전 | 0

| 수락됨

답변 있음

Describing a sum with a while loop

I'm pretty sure that adding a big number to 0 will bump you over pi on the first iteration, but maybe that's just me. I would do...

Describing a sum with a while loop

I'm pretty sure that adding a big number to 0 will bump you over pi on the first iteration, but maybe that's just me. I would do...

약 2달 전 | 0

답변 있음

Select value from the list by defining criteria

I would use readtable to import the data, the logic indexing to narrow down the results. data = readtable('mydata.xlsx'); redu...

Select value from the list by defining criteria

I would use readtable to import the data, the logic indexing to narrow down the results. data = readtable('mydata.xlsx'); redu...

약 2달 전 | 0

| 수락됨

답변 있음

How to make matlab variables named as excel header

It sounds like readtable might be what you're looking for. I don't think it's exactly what you're asking, but it should recogniz...

How to make matlab variables named as excel header

It sounds like readtable might be what you're looking for. I don't think it's exactly what you're asking, but it should recogniz...

약 2달 전 | 0

답변 있음

Matrix from an array

Not sure how to do it without a loop or just defining the indices, but here's something simple. A = 1:15; for i = 1:length(A)/...

Matrix from an array

Not sure how to do it without a loop or just defining the indices, but here's something simple. A = 1:15; for i = 1:length(A)/...

약 2달 전 | 0

답변 있음

I want to circular shift rows of ' ww ' this circular shift depend on the numbers of 'r' array in the order , when the r numbers is change the circular shift is change for the ww array rows .

If I am understanding r correctly, you want to move the respective rows from their current positions to that position plus r(i)....

I want to circular shift rows of ' ww ' this circular shift depend on the numbers of 'r' array in the order , when the r numbers is change the circular shift is change for the ww array rows .

If I am understanding r correctly, you want to move the respective rows from their current positions to that position plus r(i)....

2달 전 | 1

| 수락됨

답변 있음

Extract Variable/column with variable name from table

I believe you can get this as a return. T.Properties.VariableNames % T is the table variable Additionally, because you're putt...

Extract Variable/column with variable name from table

I believe you can get this as a return. T.Properties.VariableNames % T is the table variable Additionally, because you're putt...

2달 전 | 0

답변 있음

My code is generating this error " Index exceeds matrix dimensions" . Apparently it looks fine. Still can not figure out the problem.

dfdc1(i,j) = (L/M) - M*(log(1 - c1(i,j) - c2(i,j)) - log(c1(i,j)))/M; c1 and c2 are defined as single values (0.1 and 0.0001), ...

My code is generating this error " Index exceeds matrix dimensions" . Apparently it looks fine. Still can not figure out the problem.

dfdc1(i,j) = (L/M) - M*(log(1 - c1(i,j) - c2(i,j)) - log(c1(i,j)))/M; c1 and c2 are defined as single values (0.1 and 0.0001), ...

2달 전 | 0

| 수락됨

질문

Extracting data from ascii file using regexp

I have an ascii file which produces the following text. 1 $FLAG1 NP1=8.,NP2=1.,P2=2.36,P3=3000000., 2 P1=0.,4....

2달 전 | 답변 수: 0 | 0

답변 있음

Create variable from an excel entry

Hmm, I normally wouldn't recommend anybody do this, and others might still disagree, but I think eval will do what you're lookin...

Create variable from an excel entry

Hmm, I normally wouldn't recommend anybody do this, and others might still disagree, but I think eval will do what you're lookin...

2달 전 | 0

답변 있음

Removing nested for loops for quicker time

I'm shooting in the dark a bit on this one, but I think you can get rid of both loops. The only thing I'm not entirely sure abou...

Removing nested for loops for quicker time

I'm shooting in the dark a bit on this one, but I think you can get rid of both loops. The only thing I'm not entirely sure abou...

2달 전 | 0

답변 있음

Array indexing, matrix indexing

Personally, I don't think the loops are necessary. It's not much cleaner looking than the loops, but I suspect it will run more ...

Array indexing, matrix indexing

Personally, I don't think the loops are necessary. It's not much cleaner looking than the loops, but I suspect it will run more ...

2달 전 | 0

| 수락됨

답변 있음

picking up data file in each iteration

The best way I know how to do this is by listing all of the files using dir, and then looping through the files. flist = dir('*...

picking up data file in each iteration

The best way I know how to do this is by listing all of the files using dir, and then looping through the files. flist = dir('*...

2달 전 | 1

답변 있음

Forloop taking too long to execute in code

Some things that I have noticed. [Dim1, Dim2, Dim3] = size(blind(1).VMPData); fmap = zeros(175, 121, 139); Might be smart to ...

Forloop taking too long to execute in code

Some things that I have noticed. [Dim1, Dim2, Dim3] = size(blind(1).VMPData); fmap = zeros(175, 121, 139); Might be smart to ...

2달 전 | 0

| 수락됨

답변 있음

How do I add text to the top of a CSV file?

The best way I have found to do this is with a combination of fprintf and dlmwrite. While csvwrite is nice for writing out the d...

How do I add text to the top of a CSV file?

The best way I have found to do this is with a combination of fprintf and dlmwrite. While csvwrite is nice for writing out the d...

2달 전 | 0

| 수락됨

답변 있음

Can somebody explain me this answer?

a=[1 2; 3 4]; % Dictates a matrix, 'a,' and it values. Is a 2x2 matrix a(3*ones(2)) % Calls the elements of 'a' which are locat...

Can somebody explain me this answer?

a=[1 2; 3 4]; % Dictates a matrix, 'a,' and it values. Is a 2x2 matrix a(3*ones(2)) % Calls the elements of 'a' which are locat...

2달 전 | 1

답변 있음

Finding the maximum output value and corrosponding input for a function

I'm going to make some assumptions with this answer, but I will try to explain them. The first assumption is that you know how ...

Finding the maximum output value and corrosponding input for a function

I'm going to make some assumptions with this answer, but I will try to explain them. The first assumption is that you know how ...

2달 전 | 0