Answered
I keep getting "Error using / Arguments must be numeric, char, or logical. " in bayesopt.
Anonymous functions are compact, but less useful for debugging. Use a normal function instead: fxc = @yourFcn; xvar = optimiz...

1 year ago | 0

Answered
How to add values in coloumn with corresponding of logical array?
Start from the end: s = 0; for k = size(Event, 1):-1:1 if Event(k, 10) % You can omit the == 1 s = s + Event(k,...

1 year ago | 0

| accepted

Answered
Error using horzcat Dimensions of arrays.
num2str(x) replies a CHAR matrix, if x contains several rows: a = num2str(rand(2)) You cannot concatenate a CHAR vector and a ...

1 year ago | 0

| accepted

Answered
Solving a differential equation using ode45
θ'' - µ*θ'^2 + (g/r)*(µ*cos(θ) - sin(θ)) = 0 means: θ'' = µ*θ'^2 - (g/r)*(µ*cos(θ) - sin(θ)) This does not match: g(2,1) = -...

1 year ago | 1

Answered
Set 2 structure fields to be the same result when 1 is a function call within a structure element
You can use memoize or a simple tool like here: https://www.mathworks.com/matlabcentral/answers/1892960-memoize-save-restore-cac...

1 year ago | 0

Answered
Round values to specific number
The colon operator creates a vector from the 1st argument in steps of the 2nd argument until the 3rd argument, but it does not i...

1 year ago | 0

Answered
Opposite command of strfind?
No, strfind does not replie true for any inputs. It replies the indices of found matchs. Maybe you mean: a = "Milano"; b = "M...

1 year ago | 0

| accepted

Answered
Error Using *. Matrix Dimensions Must Agree
The error message is clear: The dimension of the operators do not match. We cannot run your code (posted as screenshot unfortuna...

1 year ago | 0

| accepted

Answered
After set the path of "mosek", the files still can't work. (macOS)
Obviously the step "when i add the path to MATLAB" is not successful. So please post, how you do this. Remember that the path i...

1 year ago | 0

Answered
Compiled code to use str2func to call an application (mlapp file) fails while the same code works in the MATLAB environment
A bold guess: Is HBCPlot() included in the compiled application? If its name is hidden, Matlab cannot guess, that it has to be i...

1 year ago | 0

| accepted

Answered
short way to bar plot a discretize vector?
A = rand(1, 100); edges = linspace(0, 1, 6); dsc = discretize(A, edges); result = accumarray(dsc(:), A(:)); % Default ...

1 year ago | 0

| accepted

Answered
String convertion to date
a = '16deNoviembredel2017'; b = '20:56:14'; dt_event = datetime([a,b], 'Locale', 'es_ES', ... 'InputFormat', 'dd''de''MMM...

1 year ago | 2

| accepted

Answered
Output of values via a callback function
Callbacks do not have an output. Store obtained data in the UserData or ApplicationData of the calling object.

1 year ago | 1

| accepted

Answered
I have been trying to fix the problem of this code but unfortunately It keep saying ERORR on line 71 which is [y= dfl(xo)\fl(xo)]. Need to help?
"Unrecognized function or variable 'dfl'." - The error message seems to be clear: The expression "dfl" is unknown. Do you expect...

1 year ago | 0

| accepted

Answered
How to compile .mex from folders path?
@Gundeep: Prefer using absolute paths. If e.g. the folder "mexFunctions" is in the current folder, use: addpath(fullfile(cd, 'm...

1 year ago | 0

| accepted

Answered
Out of memory error in Matlab and How to solve it?
Of course an out-of-memory problem is solved, if more RAM is available. But if the equation is stiff, this solution is of tempor...

1 year ago | 0

Answered
convert 1x20 double struct into a vector containing 20 values
With wild guessing: S.y = rand(1, 20); % Is this equivalent to your struct? plot(S.y); % Is this the way your get a ...

1 year ago | 0

Answered
load a large text file and split it after a specific character
S = readlines('YourFile.txt'); ind = [find(startsWith(S, '$')); numel(S) + 1]; % [EDITED, readlines reply column vector] n ...

1 year ago | 0

Answered
How to break data in to groups using while loop?
matrix = [1 50 60 70 50 40; ... 2 NaN 10 20 10 10; ... 3 NaN 20 NaN NaN NaN; ... 1 NaN 60 30 40...

1 year ago | 0

Answered
Attempt to grow array along ambiguous dimension. it happens when N,M are smaller then the total of A,B. can I make my code work for any value of N,M? if so how would I do that
Some simplifications: Use numel(C) instead of length(C(:)). C(1:end) is exactly the same as C. The values to not matter the ...

1 year ago | 1

Answered
my code keeps looping indefinitely and I could not figure out why, please help
No, the loops do run run infinitely. They are only slow. Check this with displaying a loop counter. Use the profile to find the...

1 year ago | 0

| accepted

Answered
Is it possible to display text in the console using latex expressions ?
LaTeX is not an option in the command window. Using Unicode characters works for some fonts, but fails with other font. The res...

1 year ago | 0

| accepted

Answered
how do i join cell array strings for plotting
Dicide to use a better input format. Either a cell string: C = {'abc\_111', 'def\_111', 'ghi\_111'; ... 'abc\_123', 'abc\...

1 year ago | 0

Answered
How to find the longest distance normal to line from the dataplot?
If you rotate the X and Y coordinates of the graph such that the connection between start and end point is parallel the X axis, ...

1 year ago | 0

| accepted

Answered
Automating length with reshaping, and using reshape to loop through data.
See reshape - simply use [] for the free dimension to be adjusted automatically: tt = reshape(t, 3, []).' Note: While ' is the...

1 year ago | 0

| accepted

Answered
error described on the command window does not appear on code analyzer
The code analyzer shows typing errors and other static problems. The error message you get is a run-time problem, which occurs ...

1 year ago | 0

Answered
Error in running the code
dlmread cannot handle the double quotes around the numbers. Use modern import functions instead, e.g. readmatrix(). The option '...

1 year ago | 0

Answered
I have a string with 10 variables created using randi, between 0 and 1, in the last 5 variables (i.e 5-10 variables) i want maximum 2 places with 1 only (eg:- 1011101001).
nVar = 10; last = 5; a = randi([0, 1], 1, nVar - last); b = zeros(1, last); n = randi([0, 2]); % 0, 1 or 2 b(rand...

1 year ago | 0

| accepted

Answered
How to simplify too much of if
Change: if (0<S)&&(S<=10) if AggS==10 if fap==40 if fwcr==0.5 fp=39; e...

1 year ago | 0

Load more