Community Profile

3,044 2018 年以降の合計貢献数

Communication through MATLAB is always better than arguing.

How to check if cell has particular value or not?
contains() - if it contains "NaN" a string isnan() - if it contains NaN value

| 採用済み

XMIN must be a floating point scalar when xmin is from vpasolve
They are of symbolic type to convert them use double() : xmax=double(solx(3)); xmin=double(solx(4));

| 採用済み

find a max value in function
Add the below after mesh() call: mx = z==max(z(:)); mn = z==min(z(:)); hold on plot3(x(mx),y(mx),z(mx),'ok') plot3(x(mn),y(...

| 採用済み

How can i find properties of value that coming from which array&cell?
Use the second output of *max() & min()*

Vector inside another vector
People don’t do homeworks here. Index K>=S to U1 lhs and S rhs by equating against each other. Since it’s your homework see Alex...

1日 前 | 0

how do i generate conditional random number either 0 or 1 ?
adj_mtr(dist_mtr > 0 & dist_mtr <= 2*r) = randi([0, 1],1,nnz(dist_mtr > 0 & dist_mtr <= 2*r));

1日 前 | 0

How do I write matrix function with symbolic expression

2日 前 | 0

Find overlap between 2 arrays?
intersect(A,B)

2日 前 | 0

| 採用済み

MATLAB Answers Wish-list #4 (and bug reports)
Sometimes deleting answer after moving is impossible for instance the below thread: https://in.mathworks.com/matlabcentral/answ...

3日 前 | 0

why is my code not working?
Probably you want (no loops needed): ii = linspace(0.0001,0.0009,1000); Fm = (0.25).*(((log((2.7*10^-5)+... (2.51.*((Rey....

3日 前 | 1

Hi , i have a matrix and need to extract the column in this way , thank you
idx= [ 1 5 9 13 ]; A(:,idx) % 4 X 4 A(:,setdiff(1:size(A,2),idx)) % 4 X 12

3日 前 | 0

| 採用済み

Having trouble to solve equations
Use fsolve(): E=1.42; F=@(x)[((E+x(1))*0.1+(-x(2)-7*x(3))*(((E+x(1))*(E+x(1))*(E+x(1))*(E+x(1)))/(((E+x(1))*(E+x(1))*(E+x(1))...

3日 前 | 1

| 採用済み

e = eccentricity(1,2) % function call function e = eccentricity(a,b) % function definition , a & b assumed as scalars for thi...

3日 前 | 1

| 採用済み

Why am I not getting the plot results?
Because you missed the dot operators: https://in.mathworks.com/help/matlab/matlab_prog/array-vs-matrix-operations.html The bel...

4日 前 | 1

| 採用済み

sorted two different arrays
[~,idx]=sort(T{:,1}); % T your table C(idx,:) % C your cell become sorted according to first column of table T(idx,:) ...

4日 前 | 1

| 採用済み

is there such a matrix operator
sum(X .* Y)

4日 前 | 1

| 採用済み

vector = [vector,zeros(1,102)]

4日 前 | 0

| 採用済み

Sum specific colums based on a criteria
sum(R(:,any(R>=.2)))

4日 前 | 0

| 採用済み

Am getting the error ' Array indices must be positive integers or logical values.
xander = 1/n * h1 * (sum(kiki * (([m{:}] - numel(Test)/h1)))); % ^ missed

4日 前 | 0

| 採用済み

Is the following sample mean and variance fully vectorised?
MATLAB already has inbuilt functions named <https://in.mathworks.com/help/matlab/ref/mean.html *mean()*> and <https://in.mathwor...

4日 前 | 0

compare two matrix one by one number to eachother
% a = > first matrix % b = > second matrix sum(a==b) % each column -> tells the number of counts of each matrix's column compa...

4日 前 | 1

| 採用済み

How to insert a new vector to matrix in every iteration?
Trivially done without a loop: out = [repelem(x,1:numel(x));repmat(y,1,numel(x))] With loop: x=1:3; y=4:5; ctr=1; out=zer...

4日 前 | 1

| 採用済み

Swap first and last word in a string
Simpler: s = 'hello world'; Wanted = swap(s) % function call % function function Wanted = swap(str) S = regexp(str,'\S*'...

5日 前 | 0

How to read multiple .txt file in MATLAB ?
Files = dir('*.txt'); n = numel(Files); MAX = zeros(n,1); for k = 1:n MAX(k) = mean(reshape(load(Files(k)....

5日 前 | 0

extract column name of table with Nan column
patients.Properties.VariableNames(all(isnan(patients{:,:})))

5日 前 | 0

| 採用済み

logarithmic equation with ln
b = 0.174 * log( 59.6 * rf ./rs )

5日 前 | 0

| 採用済み

I don't know how to plot what answer of dsolve
syms y(x) Dy = diff(y); D2y = diff(y,2); k=3; % example f = dsolve(D2y==-(exp(-k^2))*y,y(0)==1,Dy(1)==0); fplot(f);

5日 前 | 0

Convert Cell to variable name array
A={'sample1' 'sample2' 'sample3'} ; a = array2table(rand(3)); % an example a.Properties.VariableNames=A

5日 前 | 0

| 採用済み

Problem with university's licence