Answered

loop: stop if value repeats

I'm assuming you have all four of these commands within some kind of loop. Without the loop I have not tested what I'm going to ...

loop: stop if value repeats

I'm assuming you have all four of these commands within some kind of loop. Without the loop I have not tested what I'm going to ...

2 Tage ago | 1

Answered

How to sequentially import csv files, access, edit and save the data?

To save the results of a command each time you go through the loop you need to index the output. I recommend just adding a struc...

How to sequentially import csv files, access, edit and save the data?

To save the results of a command each time you go through the loop you need to index the output. I recommend just adding a struc...

2 Tage ago | 0

Answered

Creating matric of multiple arrays

You should be able to accomplish what you're looking for with some matrix indexing, no loop necessary. x = 1:100; k = 12; a =...

Creating matric of multiple arrays

You should be able to accomplish what you're looking for with some matrix indexing, no loop necessary. x = 1:100; k = 12; a =...

3 Tage ago | 0

| accepted

Answered

What is wrong with this code?

I would think you could do this with cellfun and some logic, but I could be wrong. cellfun(@(s) s((1:end)<0,1) = NaN,Radiidiffe...

What is wrong with this code?

I would think you could do this with cellfun and some logic, but I could be wrong. cellfun(@(s) s((1:end)<0,1) = NaN,Radiidiffe...

3 Tage ago | 0

Answered

Textscan for comma seperated file with mixed format

Have you tried using readtable? It has a delimited text option, and tends to be a bit better about handling different types of d...

Textscan for comma seperated file with mixed format

Have you tried using readtable? It has a delimited text option, and tends to be a bit better about handling different types of d...

3 Tage ago | 0

| accepted

Answered

Help with MATLAB code on low rank assumption using nuclear norm using CVX and Matlab!

I believe the issue is with calling Xe(:) instead of Xe. Others who know more might be able to correct me, but my working theory...

Help with MATLAB code on low rank assumption using nuclear norm using CVX and Matlab!

I believe the issue is with calling Xe(:) instead of Xe. Others who know more might be able to correct me, but my working theory...

4 Tage ago | 0

Answered

Error in importing the matlab ouput to excel file

It looks like you're trying to output a symbolic variable to excel, which I don't think is allowed. Try converting to double fir...

Error in importing the matlab ouput to excel file

It looks like you're trying to output a symbolic variable to excel, which I don't think is allowed. Try converting to double fir...

4 Tage ago | 0

Answered

multiple matrix step through for loop

Instead of doing a loop you can just do a bit of logic to the arrays. risk = ones(length(age),1,1); risk(age>=75&bmi>=50&smoke...

multiple matrix step through for loop

Instead of doing a loop you can just do a bit of logic to the arrays. risk = ones(length(age),1,1); risk(age>=75&bmi>=50&smoke...

5 Tage ago | 0

| accepted

Answered

For loop to repeat the loop with different set of value

You are seeing only the final results because you do not have your output variables indexed. for i=1:length(SNRDB) f...

For loop to repeat the loop with different set of value

You are seeing only the final results because you do not have your output variables indexed. for i=1:length(SNRDB) f...

11 Monate ago | 0

Answered

Read every file in a folder

To get information on all the files in a folder use dir, or getdir. From there, just loop through the elements of the dir output...

Read every file in a folder

To get information on all the files in a folder use dir, or getdir. From there, just loop through the elements of the dir output...

11 Monate ago | 0

Answered

Store values in an array from loop

I'm not sure what you mean by printing the 'name' associated to a data set, but there are my modifications to what you have setu...

Store values in an array from loop

I'm not sure what you mean by printing the 'name' associated to a data set, but there are my modifications to what you have setu...

11 Monate ago | 0

| accepted

Answered

i need some help

If I'm understanding what you're trying to do, you're only missing parentheses. >> n = 10; >> p(10) = 2; >> p(n) p(n) = ...

i need some help

If I'm understanding what you're trying to do, you're only missing parentheses. >> n = 10; >> p(10) = 2; >> p(n) p(n) = ...

11 Monate ago | 0

Answered

plot graphic with different color

If you're using the plot command, it is relatively easy to define a different color for a plot. Setting the condition where this...

plot graphic with different color

If you're using the plot command, it is relatively easy to define a different color for a plot. Setting the condition where this...

11 Monate ago | 0

Answered

How to map and plot each y coordinate in a y coordinate array with each coordinate in a x coordinate array??

plot(X,Y) Was there something more to your question that I didn't understand?

How to map and plot each y coordinate in a y coordinate array with each coordinate in a x coordinate array??

plot(X,Y) Was there something more to your question that I didn't understand?

12 Monate ago | 0

Answered

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

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

12 Monate ago | 0

| accepted

Answered

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

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

etwa ein Jahr ago | 0

Answered

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

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

etwa ein Jahr ago | 0

| accepted

Answered

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

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

etwa ein Jahr ago | 0

| accepted

Answered

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

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

etwa ein Jahr ago | 1

Answered

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

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

etwa ein Jahr ago | 0

Answered

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

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

etwa ein Jahr ago | 0

Answered

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

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

etwa ein Jahr ago | 0

| accepted

Answered

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

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

etwa ein Jahr ago | 0

Answered

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

etwa ein Jahr ago | 0

| accepted

Answered

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;

etwa ein Jahr ago | 0

Answered

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

etwa ein Jahr ago | 1

| accepted

Answered

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

etwa ein Jahr ago | 0

Answered

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

etwa ein Jahr ago | 1

| accepted

Answered

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

etwa ein Jahr ago | 0

| accepted

Answered

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

etwa ein Jahr ago | 0