回答済み

fill a matrix with binary code in a for loop

code = [0 1 1] for k = 1:length(bitcode) bitcode(k,:) = code end

fill a matrix with binary code in a for loop

code = [0 1 1] for k = 1:length(bitcode) bitcode(k,:) = code end

6ヶ月 前 | 1

| 採用済み

回答済み

Array Keeps creating 0's in my Loop

Your problem lies in the line B(1,counter)=indx counter is the max value of the loop and doesn't change - you should use the l...

Array Keeps creating 0's in my Loop

Your problem lies in the line B(1,counter)=indx counter is the max value of the loop and doesn't change - you should use the l...

6ヶ月 前 | 0

| 採用済み

回答済み

How to create a Matrix

A=[22 18 14; 21 17 13; 20 16 12; 19 15 11] I would recommend you have a look at the Matlab Onramp course. It will give you a ...

How to create a Matrix

A=[22 18 14; 21 17 13; 20 16 12; 19 15 11] I would recommend you have a look at the Matlab Onramp course. It will give you a ...

6ヶ月 前 | 1

回答済み

Finding precipitation of specific coordinate matrix

A = [36 35 100; 36 34 78; 36 33 42; 36 32 51; 35 35 83; 35 34 72; 35 33 80 ; ] ...

Finding precipitation of specific coordinate matrix

A = [36 35 100; 36 34 78; 36 33 42; 36 32 51; 35 35 83; 35 34 72; 35 33 80 ; ] ...

6ヶ月 前 | 0

| 採用済み

回答済み

Unrecognized function or variable in live script

Variables are local to functions. The only (well strictly speaking not the only) way to get them into a function is to pass them...

Unrecognized function or variable in live script

Variables are local to functions. The only (well strictly speaking not the only) way to get them into a function is to pass them...

6ヶ月 前 | 1

| 採用済み

回答済み

How can I display prime numbers with their number of order?

A simple solution would be to just add a counter variable: limit = input('Prime numbers up to : '); if limit == 1 ...

How can I display prime numbers with their number of order?

A simple solution would be to just add a counter variable: limit = input('Prime numbers up to : '); if limit == 1 ...

6ヶ月 前 | 0

| 採用済み

回答済み

Trying to build an array of row vectors such that every possible combination of the 3 vector components is included

If you are going the loop route, then you want all three loops to be nested, rather than three separate loops. Something more li...

Trying to build an array of row vectors such that every possible combination of the 3 vector components is included

If you are going the loop route, then you want all three loops to be nested, rather than three separate loops. Something more li...

6ヶ月 前 | 0

| 採用済み

回答済み

Extracting number in array at certain threshold and determine its position

X=[10 8 6 7 8 4 12] index=find(X>5) values=X(index)

Extracting number in array at certain threshold and determine its position

X=[10 8 6 7 8 4 12] index=find(X>5) values=X(index)

6ヶ月 前 | 1

| 採用済み

回答済み

This is the first part of my program, however I'd like the whole program to stop running and end, if , the choice is 'yes'. Because currently the code just keeps on running even after loading the saved model.

return should give control back to whatever invoked the script choice = questdlg('Would you like to load a saved spatial model...

This is the first part of my program, however I'd like the whole program to stop running and end, if , the choice is 'yes'. Because currently the code just keeps on running even after loading the saved model.

return should give control back to whatever invoked the script choice = questdlg('Would you like to load a saved spatial model...

6ヶ月 前 | 0

| 採用済み

回答済み

Creating a new column in a table which is true or false

vals=subsety{:,1}; subsetx{:,3}=subsetx.SIC==vals(2,1)|subsetx.SIC==vals(1,1);

Creating a new column in a table which is true or false

vals=subsety{:,1}; subsetx{:,3}=subsetx.SIC==vals(2,1)|subsetx.SIC==vals(1,1);

6ヶ月 前 | 0

回答済み

xlsread isn't storing all the cell values from a column

I don't know if this is the problem in your case, but Matlab docs have not recommended the use of xlsread since R2019a. That's n...

xlsread isn't storing all the cell values from a column

I don't know if this is the problem in your case, but Matlab docs have not recommended the use of xlsread since R2019a. That's n...

6ヶ月 前 | 0

回答済み

FIR Filter 10th order with a for loop

On the first iteration of your loop the indexing expression will expand to new_data = data_h([1 0 -1 -2 -3 -4 ...

FIR Filter 10th order with a for loop

On the first iteration of your loop the indexing expression will expand to new_data = data_h([1 0 -1 -2 -3 -4 ...

6ヶ月 前 | 0

| 採用済み

回答済み

How do I show variables in the workspace?

Put your cursor on the line at the top and drag the column to increase its width until the column is wide enough to show the var...

How do I show variables in the workspace?

Put your cursor on the line at the top and drag the column to increase its width until the column is wide enough to show the var...

6ヶ月 前 | 1

| 採用済み

回答済み

Trying to use a while loop to create experimental conditions?

Is this what you are after? ii=1 while ii <= 6 T(ii,:) = randi(2,1,6); ii = ii+1; end T = 1 1 2 ...

Trying to use a while loop to create experimental conditions?

Is this what you are after? ii=1 while ii <= 6 T(ii,:) = randi(2,1,6); ii = ii+1; end T = 1 1 2 ...

6ヶ月 前 | 1

| 採用済み

回答済み

Need to run two counters in a foor loop

One way of recreating your original sequence via the loops would be: A=ones(1,5); for iterator=1:length(A) sub=0; ...

Need to run two counters in a foor loop

One way of recreating your original sequence via the loops would be: A=ones(1,5); for iterator=1:length(A) sub=0; ...

6ヶ月 前 | 0

回答済み

How to multiply two columns of the same table?

Use curly brace to extract the column data as matrices df_train.revenue = table(df_train{:,5}.*df_train{:,6})

How to multiply two columns of the same table?

Use curly brace to extract the column data as matrices df_train.revenue = table(df_train{:,5}.*df_train{:,6})

6ヶ月 前 | 0

| 採用済み

回答済み

How would you create a script that is executed more than once?

while any(distance > 0.1) % If measured distance is greater than 0.1m, then.., writeDigitalPin(a,'D10',1); % power digital ...

How would you create a script that is executed more than once?

while any(distance > 0.1) % If measured distance is greater than 0.1m, then.., writeDigitalPin(a,'D10',1); % power digital ...

6ヶ月 前 | 0

| 採用済み

回答済み

Index in position 2 exceeds array bounds (must not exceed 1)

OK - if you look at the documentation of xlsread, it says the function is no longer recommended to be used. Better to use readta...

Index in position 2 exceeds array bounds (must not exceed 1)

OK - if you look at the documentation of xlsread, it says the function is no longer recommended to be used. Better to use readta...

6ヶ月 前 | 0

| 採用済み

回答済み

How can i enter the outputs of this for loop into an array

poweroutputs = zeros(12,1); iterator=1; for windspeedvar = [24.1 22.8 21.5 18.0 15.5 14.4 13.7 14.7 18.1 21.1 22.2 22.5]; ...

How can i enter the outputs of this for loop into an array

poweroutputs = zeros(12,1); iterator=1; for windspeedvar = [24.1 22.8 21.5 18.0 15.5 14.4 13.7 14.7 18.1 21.1 22.2 22.5]; ...

6ヶ月 前 | 0

| 採用済み

回答済み

Desired array as output; concatenation of 3 N X 1 variables into one N X 3 variable using loop.

You are overwriting mpoints on every iteration, so you will end up with only the last set of values. Try: mpoints = []; for i=...

Desired array as output; concatenation of 3 N X 1 variables into one N X 3 variable using loop.

You are overwriting mpoints on every iteration, so you will end up with only the last set of values. Try: mpoints = []; for i=...

6ヶ月 前 | 0

| 採用済み

回答済み

Index exceeds array bounds.

You have defined Glucose_Released as a scaler value Glucose_Released = 110; You are then trying to index it, which will cause ...

Index exceeds array bounds.

You have defined Glucose_Released as a scaler value Glucose_Released = 110; You are then trying to index it, which will cause ...

6ヶ月 前 | 0

| 採用済み

回答済み

How to display 1x20 array in table ?

Do you mean something like this? A=1:20 B=1:20 table(A',B','VariableNames',{'A_name','Another name'}) 20×2 table ...

How to display 1x20 array in table ?

Do you mean something like this? A=1:20 B=1:20 table(A',B','VariableNames',{'A_name','Another name'}) 20×2 table ...

6ヶ月 前 | 0

回答済み

Coding practice question, printed out a question sheet and not sure how this would be done.

X(3:3:150)=[]

Coding practice question, printed out a question sheet and not sure how this would be done.

X(3:3:150)=[]

6ヶ月 前 | 1

回答済み

Why do lines 1 and 2 create a matrix?

The code doesn't create a 2 dimensional array - it is supplied with a 2 dimensional array (argument x) and the function returns ...

Why do lines 1 and 2 create a matrix?

The code doesn't create a 2 dimensional array - it is supplied with a 2 dimensional array (argument x) and the function returns ...

6ヶ月 前 | 1

| 採用済み

回答済み

Saving plots during the run of a for-loop

1 - how big is x? If x is larger than interval you will get an indexing error. 2. Don't use the 'dot' in the saveas function (...

Saving plots during the run of a for-loop

1 - how big is x? If x is larger than interval you will get an indexing error. 2. Don't use the 'dot' in the saveas function (...

6ヶ月 前 | 1

回答済み

How can I save a b = bar(1:10) in file PDF?

Have you tried saveas saveas(b,'filename.pdf')

How can I save a b = bar(1:10) in file PDF?

Have you tried saveas saveas(b,'filename.pdf')

6ヶ月 前 | 0