Answered
not enough input arguments
ode45(@oscillator, [0, 10], [0;1])

6 years ago | 1

| accepted

Answered
Sum odd numbers in a matrix
v = zeros(size(x)); % good habit is to preallocate change *length* to *numel* that’s why people recommend to use *numel()*...

6 years ago | 0

Answered
selecting first row in cell array
a{1} % Access to first cell a{1}(1,:) % Access to first cells first row

6 years ago | 0

| accepted

Answered
Matrix division, non square matrx
Click the tag "floating-point"

6 years ago | 0

Answered
Find index of an arbitrary cell array that contains a string
Index = find(strcmp(dog,'cat'))

6 years ago | 0

| accepted

Answered
row filtering and pre-allocate
a = cell(numel(L),1); for ii = 1:numel(L); a{ii} = p(p(:,3) == L(ii),:); end celldisp(a) %or a = num2cell(p(any(p(:,...

6 years ago | 0

| accepted

Answered
Checking existence of Simulink model with full pathname
https://www.mathworks.com/help/matlab/ref/exist.html#mw_0724f29e-7978-4e62-8c9d-4425e1c7a338 - you may be looking for isfile(......

6 years ago | 0

| accepted

Answered
Adding number to an array
Wanted = sort([r1, c])

6 years ago | 0

| accepted

Answered
double quote not single quote
Directly use compose(...)

6 years ago | 0

Answered
Printing a character n times
n = 5; % number of times join(repmat(".",5,1))

6 years ago | 1

Answered
Plot x(t)=x1(t)x2(t)
<https://www.mathworks.com/help/signal/ref/square.html>

6 years ago | 0

| accepted

Answered
ode45 with multiple variables
Below is the right way to do , but maybe you're looking for matlabFunction()? Y = zeros(4,1); Y(1)=x1 Y(2)=y1 Y(3)=x2 Y(4)...

6 years ago | 1

| accepted

Answered
How can I create a for cicle for the command 'readmatrix'?
N = 380:700; C = cell(N,1); filename = '/Users/chiara/Desktop/trachea16file/%d_anaerobiosi.txt'; for k = 1:numel(N) T =...

6 years ago | 0

| accepted

Answered
Replace numbers in a matrix depending on if statements from arrays
thresh = 3.1 * sqrt(h); ix = A <= thresh; s = sum(A .* ix,2); ix1 = cumsum(~ix,2)==1; Wanted = cumsum(ix1,2) .* ... (ix...

6 years ago | 1

| accepted

Answered
Input variable value to matrix
syms s1 s2 s3 subs(left_ARE,{s1, s2, s3}, {1, 5, 10})

6 years ago | 1

| accepted

Answered
Why do I get a wrong value?
X = interp1(g,x,g(2)) %or X = x(abs( g - g(2) ) < 1e-2)

6 years ago | 0

| accepted

Answered
Error in symengine deal
syms x y r = sqrt(x^2 + y^2); ht = matlabFunction([r, r^2]); ht(2,2)

6 years ago | 1

Answered
'Matrix dimensions must agree' error on string operations
ismember(data{1}, 'Test')

6 years ago | 0

Answered
my code is not working...
*length*

6 years ago | 0

Answered
Avoiding for-loops with subsequent elements in arrays
-[0, diff(y) ./ diff(x)]

6 years ago | 0

| accepted

Answered
Use reshape or transpose to change the order of a matrix while preserving the row order
The one you have is good. One remark please use .'

6 years ago | 1

Answered
Unable to perform assignment because the size of the left side is 1-by-100 and the size of the right side is 2-by-100.
k=100; F = zeros(k); % it can be vectorised avoiding loops for x=1:k for y=1:k F(x,y)=f1(x,y); end end plot(1...

6 years ago | 0

Answered
How to solve the differential equation numerically
<https://www.mathworks.com/matlabcentral/answers/428484-how-can-i-convert-set-of-symbolic-functions-into-function-handle-so-that...

6 years ago | 0

Answered
Get all the values from a two (for loop)
Wanted = ones(numel(1:5),1).*((1:5)*2)

6 years ago | 0

Answered
Different way of representation
Opcon = cell2mat({'tc'}) % assuming they argument is a scalar

6 years ago | 0

Answered
List of IDs to matrix of indexes
v = 1:numel(list); [u,~,c] = unique(list); Wanted = arrayfun(@(x) v(list == x), u,'un',0); % or Wanted = accumarray(c,v,[],@...

6 years ago | 1

| accepted

Answered
mathematical equation in matlab
Angle = tan(sym((2*pi*0.25)))

6 years ago | 0

| accepted

Answered
A Varying matrix name in loop
N = 2; % example matrix = cell(N,1); for k = 1:N matrix{k} = rand; end celldisp(matrix)

6 years ago | 1

Answered
[DISCONTINUED] MATLAB Answers Wish-list #5 (and bug reports)
Why is it not possible to see the *code button* when editing a comment in mobile?

6 years ago | 0

Load more