답변 있음
Adding to a vector after each step of a for loop.
You need to specify the index of the element you want to replace. for i = 1:1000; steps(i) = i; end Realistically though...

2년 이하 전 | 0

| 수락됨

답변 있음
Hello! Can you help me with this?
It seems to me like you're totally overcomplicating this. Let me know if I'm interpretting the steps of your code correctly. Th...

약 2년 전 | 0

답변 있음
Access previous iteration in while loop to derive stopping criterion for differential equation correction-prediction method
In MATLAB, you cannot access the previous iteration of a loop directly. If you want to utilize that information you need to eith...

약 2년 전 | 0

| 수락됨

답변 있음
How can remove Excel column by MATLAB
The simplest way is to load the excel file with xlsread, then write the data back with only the desired columns using xlswrite. ...

약 2년 전 | 0

| 수락됨

답변 있음
Plotting a matrix in a for loop.
With MATLAB you don't really want to perform the plot inside the loop in this case. Just save your results in a matrix and plot ...

약 2년 전 | 1

답변 있음
How to save more than the last matrix in a for cycle
You need to index Sigma_elem. Sigma_elem(:,:,i,N)=EPSM(N,1:6).*e_mat/0.6; % Or something similar

약 2년 전 | 0

답변 있음
Plotting a 3-D Matrix, but only for some points
I would suggest using scatter3 to make the actual plot. I would suggest using something like find to identify the locations of t...

약 2년 전 | 0

답변 있음
how to calculate how many rows are having numeric values in a particular cell of an excel sheet data.
Read the file with xlsread, filter the NaN values, then determine the number of the remaining values. numnumerics = sum(~isnan(...

약 2년 전 | 0

| 수락됨

답변 있음
Extract and code gender string as number using if loop
Just to clarify, you have 'gender' as two separate variables, once as a variable called 'gender' which will have a numeric assig...

약 2년 전 | 0

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

약 2년 전 | 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;

약 2년 전 | 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)...

약 2년 전 | 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,...

약 2년 전 | 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년 전 | 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...

약 2년 전 | 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...

약 2년 전 | 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...

약 2년 전 | 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]...

약 2년 전 | 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...

2년 이상 전 | 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...

2년 이상 전 | 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...

2년 이상 전 | 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...

2년 이상 전 | 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 ...

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

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

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

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

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

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

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

2년 이상 전 | 0

| 수락됨

더로드