Answered
How to put multiple elements in a cell?
Let A be your 6*191 cell array. [m,n] = size(A) ; M = zeros(1,n) ; % initialize mean for i = 1:n C = cell2mat(A(:,i...

6 years ago | 0

Answered
How do I display this Matrix using fprintf
header = {'Batch1','Batch 2','Batch 3'}; A = [100.9 100.8 110.0;102.0 101.0 108.0;104.0 100.1 107.0]; fprintf('%s %s %s\n',hea...

6 years ago | 2

| accepted

Answered
How do I color a comet plot.
You can make your required plot using a loop. x = linspace(0,2*pi,1000) ; y = sin(x) ; for i = 1:length(x) plot(x(1:i)...

6 years ago | 0

Answered
How to compare values in one vector?
a=[1,2,2,5,4,4]; xbins = unique(a); [counts,centres] = hist(a,xbins); iwant = a(counts==1)

6 years ago | 0

Answered
how to use loop to create array
n2=1:1:10; n1=2; n = 100 ; B = zeros(length(n2),n) ; for i=1:length(n2) B(i,:)=linspace(n1,n2(i),n); end

6 years ago | 0

| accepted

Answered
How to solve this error "Operands to the || and && operators must be convertible to logical scalar values." ?
Your input should be a scalar..i.e y should be a scalar. y_val = [5000 17000 25000 75000]; ty = zeros(size(y_val)) ; for ...

6 years ago | 0

| accepted

Answered
How can I find the intersection points of two vectors that do not (necessarily) contain the value at the intersection point?
Try this: https://in.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections?focused=5165138&tab=function

6 years ago | 0

| accepted

Answered
save image without the white border
https://in.mathworks.com/matlabcentral/fileexchange/34898-remove-white-space-around-images

6 years ago | 1

Answered
Fast checking if array has repeated elements or not
You can simply use unique to find out whether a array has repeated elements or not. Let A be your array. if length(A)==len...

6 years ago | 0

Answered
can you help me? i want to show min and max value on RGB image with histogram, but is not work correctly?
%R Value red_min=min(R(:)) ; red_max=max(R(:)) ; %G Value green_min=min(G(:)) ; green_max=max(G(:)) ; %B Value blue_mi...

6 years ago | 0

| accepted

Answered
How to plot a straight line graph that ends up with a plateau using simple hill climber method
You have to proceed something like this: sol = 0:10 ; val0 = randsample(sol,1) ; iter = 1 ; y = zeros([],1) ; x = zeros...

6 years ago | 0

Answered
Punto de interseccion entre una funcion cualquiera y una o varias rectas verticales
Have a look on this function: https://in.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections?focused=5165138&tab=...

6 years ago | 2

| accepted

Answered
How many times does a number appear in these lines?
Read about unique. This should help you to get what you want.

6 years ago | 0

| accepted

Answered
Index of the first number divisible by 3
idx = find(mod(A,3)==0) ; iwant = idx(1)

6 years ago | 0

Answered
Converting Binary Numbers to their Decimal Equivalent
Refer this: https://in.mathworks.com/matlabcentral/fileexchange/56893-binary-float-convertor

6 years ago | 0

Answered
Removing a coordinate from a list of coordinates.
Read about setdiff and ismember.

6 years ago | 0

| accepted

Answered
Matrix split in vector
iwant = A(A>0) If you want in the order you have given. A = A' ; iwant = A(A>0)

6 years ago | 0

Answered
convert for loop to while
i = 1 ; f = 1 ; n = 3 ; while i<=n f=f*i; i = i+1 ; end

6 years ago | 0

| accepted

Answered
how to do a while loop to estimate pi using monte carlo method
https://in.mathworks.com/matlabcentral/fileexchange/33543-monte-carlo-method?focused=5201749&tab=function

6 years ago | 0

| accepted

Answered
Remove data from matrix
If A is your array.... You can remove data using: A(A>30) = [] ; A(A<25) = [] ; Or replace them with NaN's, if yu want same...

6 years ago | 1

| accepted

Answered
how to pull out indicies from a matrix
Let A be your 2*m matrix... r1 = A(1,:) ; r2 = A(2,:) ; iwant = r2(r1==1) iwant = r2(r1==2) From matrix directly. iwan...

6 years ago | 0

| accepted

Answered
Elements in array and matrix
Read about input and unique.

6 years ago | 1

Answered
how can I convert many images from m x n x 3 to m x n by rgb2gray?
img = dir('*.jpeg') ; N = length(img) ; for i = 1:N thisimg = img(i).name ; I = imread(thisimg) ; Ig = rgb2...

6 years ago | 1

| accepted

Answered
Plotting two variables from a loop
% Constants g=9.81; m=1.5; A=0.028; Cd=0.8; rho=1.225; B=(rho*Cd*A)/2; Dt=1e-6; % Initial values x=0; y=6.4008; %21...

6 years ago | 1

| accepted

Answered
plot values in the loop
p=3 ; k = 1:p ; val = zeros(1,p) ; for i = 1:length(p) %something if %something d=d+1 val(i) = ...

6 years ago | 0

Answered
How to plot an inversely proportional graph ?
plot(k,1./T) ; You can find the inverse/ reciprocal using 1./T.

6 years ago | 0

| accepted

Answered
How to make a function that calculates percentage change in a vector
Loop: x=csvread('gdp.csv') for i=1:length(x)-1 p = (x(i+1)-x(i))/(x(i)) end Vector: p = diff(x)./x(1:end-1) ;

6 years ago | 1

Answered
How get this program to calculate derivative properly?
Yn=A*sin(w*t); dYn = A*w*cos(w*t) ;

6 years ago | 0

Answered
converting 2D XY coordinated into Grid format
It depends whether your data is gridded or scattered. Follow the below code to get what you want. Let A be your m*2 array. x =...

6 years ago | 0

Answered
Area of intersection of two ellipses
You can follow the below steps. For the two ellipses i.e get coordinates of both the ellipses. Let L1, L2 be your coordinates ...

6 years ago | 0

| accepted

Load more