185 total contributions since 2015

Answered

For Loop involving n-substitution and creating it as a row vector

n=input('the number of column for row vector= '); for i=1:n b(i)=input(['b',num2str(i),'= ']); end disp(b); y=input('i...

For Loop involving n-substitution and creating it as a row vector

n=input('the number of column for row vector= '); for i=1:n b(i)=input(['b',num2str(i),'= ']); end disp(b); y=input('i...

environ 7 heures ago | 1

| accepted

Answered

Function: Compare each Element of 2 Matrix for zero and non-zero

Z = [1,0,1;1,1,1;1,0,1] Z_2 = [2,0,2;3,1,3;2,0,2] answer=sum(sum(Z_2(Z==0)))==0;%1 if it is true

Function: Compare each Element of 2 Matrix for zero and non-zero

Z = [1,0,1;1,1,1;1,0,1] Z_2 = [2,0,2;3,1,3;2,0,2] answer=sum(sum(Z_2(Z==0)))==0;%1 if it is true

1 jour ago | 0

| accepted

Answered

Indices on the left side are not compatible with the size of the right side

the problem is because you do not need to use the loop for: %begin with specifying constants AB=0.6; BC=0.1; BG=0.08; AG=A...

Indices on the left side are not compatible with the size of the right side

the problem is because you do not need to use the loop for: %begin with specifying constants AB=0.6; BC=0.1; BG=0.08; AG=A...

1 jour ago | 0

Answered

I want the code to repeat for 10,000 times and add the new value to the matrix but I don't know how? Please help.

nsims = 10000; people = repmat(100,1,100); simsize = numel(people); for k = 1:nsims y = randperm(simsize, 2); ...

I want the code to repeat for 10,000 times and add the new value to the matrix but I don't know how? Please help.

nsims = 10000; people = repmat(100,1,100); simsize = numel(people); for k = 1:nsims y = randperm(simsize, 2); ...

1 jour ago | 0

| accepted

Answered

How to force reshape for change elements?

m=input('z= '); n=m+1; x=zeros(n,1); for i=1:n x(i)=input(['x',num2str(i),'= ']); end x=repmat(x,1,n).^repmat((0:1:m),...

How to force reshape for change elements?

m=input('z= '); n=m+1; x=zeros(n,1); for i=1:n x(i)=input(['x',num2str(i),'= ']); end x=repmat(x,1,n).^repmat((0:1:m),...

1 jour ago | 1

| accepted

Answered

'Store the first N (user enters N) Fibonacci numbers in a row vector.'I know how to get user entered number of fibbonachi numbers. But I don't know how to show them in a row vector.

clc N=input('Enter the number = '); B=zeros(1,N); B(1)=0; B(2)=1; count=1; for i=3:N B(1,i)=B(i-2)+B(i-1); end d...

'Store the first N (user enters N) Fibonacci numbers in a row vector.'I know how to get user entered number of fibbonachi numbers. But I don't know how to show them in a row vector.

clc N=input('Enter the number = '); B=zeros(1,N); B(1)=0; B(2)=1; count=1; for i=3:N B(1,i)=B(i-2)+B(i-1); end d...

1 jour ago | 1

| accepted

Answered

Checking if two matrices are similar

you can check with a tolerance: tol=0.0001;%tolerance if sqrt(sum(sum((B-S*A/inv(S)).^2)))<=tol disp('It is true') else...

Checking if two matrices are similar

you can check with a tolerance: tol=0.0001;%tolerance if sqrt(sum(sum((B-S*A/inv(S)).^2)))<=tol disp('It is true') else...

1 jour ago | 0

Answered

how can I create a function with multiple variables?

y=@(a,x,z) a(1) + (a(2)./z) + (a(3).*x) + (a(4).*x.^2) + ((a(5).*x)./z) + ((a(6).*x.^2)./z); x=[0.1 0.2 0.3 0.4 0.5 0.6 0.65 0...

how can I create a function with multiple variables?

y=@(a,x,z) a(1) + (a(2)./z) + (a(3).*x) + (a(4).*x.^2) + ((a(5).*x)./z) + ((a(6).*x.^2)./z); x=[0.1 0.2 0.3 0.4 0.5 0.6 0.65 0...

1 jour ago | 0

Answered

How to Ignore the last line from a file read

s=readmatrix(filename); s(any(isnan(s),2),:)=[]; figure plot3(s(:,1),s(:,2),s(:,3),'*-r')

How to Ignore the last line from a file read

s=readmatrix(filename); s(any(isnan(s),2),:)=[]; figure plot3(s(:,1),s(:,2),s(:,3),'*-r')

1 jour ago | 0

Answered

How can you extract odd and even rows and columns from image to seperate image outputs

B=A(2:2:size(A,1),2:2:size(A,2),:);%Even Pixels Only C=A(1:2:size(A,1),1:2:size(A,2),:);%Odd Pixels Only

How can you extract odd and even rows and columns from image to seperate image outputs

B=A(2:2:size(A,1),2:2:size(A,2),:);%Even Pixels Only C=A(1:2:size(A,1),1:2:size(A,2),:);%Odd Pixels Only

1 jour ago | 0

| accepted

Answered

gpuArray for vpa (variable precision arithmetic)

In this case you are going to have to sacrifice something, if you use VPA the matrices become symbolic, therefore all the operat...

gpuArray for vpa (variable precision arithmetic)

In this case you are going to have to sacrifice something, if you use VPA the matrices become symbolic, therefore all the operat...

1 jour ago | 0

Answered

Create an RGB Image using a loop by choosing a random color for each pixel

no te sirve así? for i=1:10 imagen=uint8(randi(255,10,10,3)); figure imshow(imagen) end

Create an RGB Image using a loop by choosing a random color for each pixel

no te sirve así? for i=1:10 imagen=uint8(randi(255,10,10,3)); figure imshow(imagen) end

1 jour ago | 0

Answered

inserting vectors into another new vector

A=[7 17 27 35]; B=[13 22 30 15]; N = max(numel(A),numel(B)); C=[A nan(1,N-numel(A)); B nan(1,N-numel(B))]; C(isnan(C))=[] C...

inserting vectors into another new vector

A=[7 17 27 35]; B=[13 22 30 15]; N = max(numel(A),numel(B)); C=[A nan(1,N-numel(A)); B nan(1,N-numel(B))]; C(isnan(C))=[] C...

1 jour ago | 1

| accepted

Answered

How do I plot one 3D vector arrow for all points in a 3d scatter

% creating 3d scatter plot % Load data T = table((rand(100,3))); T = [table(T.Var1(:,1),'VariableNames',{'A'}),table(T.Var1(...

How do I plot one 3D vector arrow for all points in a 3d scatter

% creating 3d scatter plot % Load data T = table((rand(100,3))); T = [table(T.Var1(:,1),'VariableNames',{'A'}),table(T.Var1(...

1 jour ago | 0

Answered

Represent the result of matrices manipulation as rational numbers

format rat A = [ 1/2 1/3 ; 4 5/6] B = [ 2 1/4 ; 4 1 ] C = A+B

Represent the result of matrices manipulation as rational numbers

format rat A = [ 1/2 1/3 ; 4 5/6] B = [ 2 1/4 ; 4 1 ] C = A+B

1 jour ago | 0

| accepted

Answered

How would I only save variables in a list to a matlab no recursively?

n=5;%signal1 .... signal5 signallist=split(num2str(1:n,'signal%i ')); filename='here.mat'; save(filename,signallist{:})

How would I only save variables in a list to a matlab no recursively?

n=5;%signal1 .... signal5 signallist=split(num2str(1:n,'signal%i ')); filename='here.mat'; save(filename,signallist{:})

1 jour ago | 0

Answered

Help with creating a different type of pareto chart?

Y=[ 81 15 21 38 38 21 31 27 22 135 55 24 54 66 97 11 117 332 140 34 456 4...

Help with creating a different type of pareto chart?

Y=[ 81 15 21 38 38 21 31 27 22 135 55 24 54 66 97 11 117 332 140 34 456 4...

1 jour ago | 1

| accepted

Answered

Move to next selection

so you don't need to place an else in the first: choice = menu("Do you want to see the opening times of this recycling centre?...

Move to next selection

so you don't need to place an else in the first: choice = menu("Do you want to see the opening times of this recycling centre?...

1 jour ago | 0

| accepted

Answered

How to read multiple video from a folder....?

s=dir('*.avi'); files={s.name}; for k=1:numel(files) v= VideoReader(files{k}); j=0; while %condition %yourcodehere en...

How to read multiple video from a folder....?

s=dir('*.avi'); files={s.name}; for k=1:numel(files) v= VideoReader(files{k}); j=0; while %condition %yourcodehere en...

1 jour ago | 0

| accepted

Answered

How do I produce a plot as a line, not just single points?

solution: figure; %hold on; deltaH=-20; R=0.001987; T1=305; Kc1=1000; T=300:10:600; Kc=Kc1.*exp(-(deltaH/R).*((1./T)-(...

How do I produce a plot as a line, not just single points?

solution: figure; %hold on; deltaH=-20; R=0.001987; T1=305; Kc1=1000; T=300:10:600; Kc=Kc1.*exp(-(deltaH/R).*((1./T)-(...

1 jour ago | 0

| accepted

Answered

How to save output from loops into matrix w/o using vector input?

test it %% Load Matlab Directory myFolder = pwd; % Wherever you want. filePattern = fullfile(myFolder, '*.mat*') theFiles =...

How to save output from loops into matrix w/o using vector input?

test it %% Load Matlab Directory myFolder = pwd; % Wherever you want. filePattern = fullfile(myFolder, '*.mat*') theFiles =...

2 jours ago | 0

| accepted

Answered

My code keeps saying the variable u appears to be changing as well as index exceeds the number of array elements(1). Could someone help me with this

correction: L = 1 % length of domain in x direction tmax = 10 % end time nx = 11 % number of nodes in x direction nt = 1...

My code keeps saying the variable u appears to be changing as well as index exceeds the number of array elements(1). Could someone help me with this

correction: L = 1 % length of domain in x direction tmax = 10 % end time nx = 11 % number of nodes in x direction nt = 1...

2 jours ago | 0

Answered

Difference between "mesh" plot and "plot3" graphs

The main notable difference is that mesh draws a three-dimensional surface while plot3 only draws three-dimensional lines, you c...

Difference between "mesh" plot and "plot3" graphs

The main notable difference is that mesh draws a three-dimensional surface while plot3 only draws three-dimensional lines, you c...

3 jours ago | 0

| accepted

Answered

Sum two arrays using logical indices

Could it be that way? : a (or (a_logical, b_logical)) + b (or (a_logical, b_logical))

Sum two arrays using logical indices

Could it be that way? : a (or (a_logical, b_logical)) + b (or (a_logical, b_logical))

3 jours ago | 0

Answered

saving to cell2mat without overwriting

x = B(:,2) A=[]; for i=3: length(B) y = B(:,i) [fitresult, gof] = createFit(x, y) A=[A cell2mat(struct2cell(gof))] end

saving to cell2mat without overwriting

x = B(:,2) A=[]; for i=3: length(B) y = B(:,i) [fitresult, gof] = createFit(x, y) A=[A cell2mat(struct2cell(gof))] end

3 jours ago | 0

| accepted

Answered

How can I use Textbox input from GUI in a separate script?

you can simply call the function at the end, without the extension .m and it must be in the same folder of the graphical interfa...

How can I use Textbox input from GUI in a separate script?

you can simply call the function at the end, without the extension .m and it must be in the same folder of the graphical interfa...

3 jours ago | 0

Answered

why save '.mat' as 'ascii' file appears as FILE instead of txt

because the computer has to be guided by the file extension to know what each thing is, all the .mat files are going to open wit...

why save '.mat' as 'ascii' file appears as FILE instead of txt

because the computer has to be guided by the file extension to know what each thing is, all the .mat files are going to open wit...

3 jours ago | 0

Answered

create a new matrix that extracts the values in matrix A as stipulated in matrix B

C=B(A);

create a new matrix that extracts the values in matrix A as stipulated in matrix B

C=B(A);

3 jours ago | 0

| accepted

Answered

How to swap array element from two arrays conditionally

C=A; C(B~=0)=B(B~=0) also could help you: C=max(A,B)

How to swap array element from two arrays conditionally

C=A; C(B~=0)=B(B~=0) also could help you: C=max(A,B)

3 jours ago | 1

Answered

Reading in data from files in for loop

%var def% lopoff = 1034; %initial data point sample_stopcount = 41000; %last data point folder = uigetdir('C:\Users\me\Docume...

Reading in data from files in for loop

%var def% lopoff = 1034; %initial data point sample_stopcount = 41000; %last data point folder = uigetdir('C:\Users\me\Docume...

3 jours ago | 0