A répondu
How to replace a pixel value of my image with another value?
works for RGB ,grayscale, and black and white images yourimage(34,71,:)=yourimage(34,55,:)

environ 4 ans il y a | 0

| A accepté

A répondu
calling a callback function from script
is y = zeros(1,((a-1)/b)); you have ":" instead of a "," a = 10; b = 0.01; T = 200; y = zeros(1,((a-1)/b)); L = length(y);...

environ 4 ans il y a | 0

| A accepté

A répondu
Saving user input and write into .csv file?
solution: writecell(answer,'myfilename.csv') and for get the file after you can use: readcell('myfilename.csv')

environ 4 ans il y a | 0

A répondu
Loading MAT file problem
write the whole word in lowercase : load('1st_part_result.mat')

environ 4 ans il y a | 0

A répondu
Summation of an array
if length(P) and length(Y) is N: x=sum(P.*Y) in another case: N=5; %set any value for N x=sum(P(1:N).*Y(1:N))

environ 4 ans il y a | 0

| A accepté

A répondu
Matrix multiplication in a for-loop
you have 1,length(theta), change it by 1:length(theta) : for j=1:length(theta) t = sum(((X * theta)- y) .* X(:,...

environ 4 ans il y a | 1

| A accepté

A répondu
Why the function doesnt work with('1234')??!
solution: save it : function coded=caesar(str,shift) a=double(str); counter=1; coded=zeros(1,length(str)); for i=[1:leng...

environ 4 ans il y a | 0

A répondu
how to replace missing values from a double inside a cell array?
newA=cellfun(@(x) x.*(x~=100000)./(x~=100000),A,'Uni',false)

environ 4 ans il y a | 0

| A accepté

A répondu
Removing all non NaN Values to a new matrix.
a solution: a=sparse(temp) a(isnan(a))=[]

environ 4 ans il y a | 3

| A accepté

A répondu
What is the script for below question?
G=blkdiag(A,B,C)

environ 4 ans il y a | 2

A répondu
There is a function that solve a system of equations with various restrictions?
debes convertir tu código a función, donde la entrada sean las 3 Q que asumes y la salida el resto de Qs, y luego de eso utiliza...

environ 4 ans il y a | 0

A répondu
n! permutation matrices
identity=eye(4); total=perms(1:4); for k=1:24 matrixperm=identity(total(k,:),:) end

plus de 4 ans il y a | 0

A répondu
matrix of matrices - matrix with matrices inside it
use cell array: A = {[1 2 3 4] [5 6 7 8]} A{1}% get matrix 1 A{2}% get matrix 2

plus de 4 ans il y a | 2

A répondu
How to compare between two cell array?
answer=cell2mat(cellfun(@(x) any(cellfun(@(y) isequal(x,y),W)),F,'uni',false))

plus de 4 ans il y a | 0

| A accepté

A répondu
Using the Mod Function to Turn a Vector (i.e. 1:15) into [1, 2, 3, 1, 2, 3, 1, 2, 3] etc.
n=3; k=[n 1:n-1]; answer=k(mod(1:15,n)+1)

plus de 4 ans il y a | 0

A répondu
How do i determine the pixel coordinates of an image using RGB values?
image=imread('peppers.png'); R=image(:,:,1);%red chanel [x,y]=find(and(R>=230,R<=250));%here coordinates

plus de 4 ans il y a | 0

A répondu
Listing elements from one matrix to another
A = [0 0 0 2 1 0 0 0 0; 1 2 0 0 0 0 3 2 0; 0 0 0 2 3 1 0 0 0]; B=reshape(A',3,[])'; B(sum(B,2)==0,:)=[]

plus de 4 ans il y a | 1

A répondu
Find missing elements of a vector
vector =1:1:80; numbers=[ 1 3 5 12 34 44 55 62 63 68 69 70 72 75 79]; another = setdiff(vector,numbers)

plus de 4 ans il y a | 3

| A accepté

A répondu
location of the i'th element
you can use nested loops for i = 1 : size(A,1) for j=1:size(A,2) A(i,j) end end with a loop: n = numel(A);...

plus de 4 ans il y a | 0

| A accepté

A répondu
real time video processing
I did real-time processing with a video, what you can do is take out the frames per second of the video and with a "tic toc" to ...

plus de 4 ans il y a | 0

A répondu
The size of the indicated variable or array appears to be changing with each loop iteration
P=zeros(1,n+1); P(1) = P_in; for i = 2:n CR = (P_out/P_in)^(1/(i+1)); P(i) = CR*P(i-1); P(i+1) = CR*P(i); end ...

plus de 4 ans il y a | 0

| A accepté

A répondu
Computation's with large numbers.
n=sym('94315998522576010519588224930693232398146802027362761139521'); answer=vpa((n-1)/2^143)

plus de 4 ans il y a | 0

| A accepté

A répondu
how to randomize a vector as fast as possible
I recommend using a MEX file https://ww2.mathworks.cn/matlabcentral/fileexchange/27076-shuffle?s_tid=FX_rc3_behav if you want t...

plus de 4 ans il y a | 0

A répondu
How i check cell in cell array is different of 0?
an example: T1={{0} {4} {5} {6} {5}} items=vertcat(T1{cellfun(@(x) ~isequal(x,{0}),T1)}); items=[items{:}];

plus de 4 ans il y a | 0

| A accepté

A répondu
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...

plus de 4 ans il y a | 1

| A accepté

A répondu
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

plus de 4 ans il y a | 0

| A accepté

A répondu
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...

plus de 4 ans il y a | 0

A répondu
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); ...

plus de 4 ans il y a | 0

| A accepté

A répondu
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),...

plus de 4 ans il y a | 1

| A accepté

A répondu
'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...

plus de 4 ans il y a | 1

| A accepté

Charger plus