Answered
Summing results of ode45
|sol = ode45(...)| replies a struct, as the error message tells clearly. Either use: x = sol.y + xc - xq; Or use two out...

9 years ago | 0

Answered
Where can I find Matlab compiler SDK in R2017b?
The "Matlab compiler SDK" is something else, also the terms "compiler" and "SDK" appear also. You need to install a compiler as ...

9 years ago | 0

| accepted

Answered
Trouble with Euler's Method in MatLab
Replace: for i = 1:n t(i + 1) = t(1) + h; y(i + 1) = y(i) + h*f(t(i), y(i)); end by for i = 2:n % ...

9 years ago | 3

| accepted

Answered
Help, secant method by recursion
All you need is to catch the output: xi = secantr(n,x0,x1,err); ^^^^

9 years ago | 0

| accepted

Answered
How do i calculate a sum using a function?
Please take the time to read the "Getting Started" chapters. Matlab's <https://matlabacademy.mathworks.com/R2017b/portal.html?co...

9 years ago | 2

| accepted

Answered
Multiple axes plot more than 2 axes
What about using the built-in |yyaxis|, or for older Matlab versions |plotyy|? Serach in the FileExchange for "plotyy" to fin...

9 years ago | 0

| accepted

Answered
how can i subtract the elements in a coloumn ?
Do you mean: diff(a(:,1)) Alternatively with a loop: n = size(a, 1) - 1; b = zeros(1, n); for k = 1:n b...

9 years ago | 1

Answered
Solving 1st ODE, while cycling a solution into 2nd ODE and using that solution in 1st ODE
See Torsten's comment: I'm not sure if this is the only problem, but this should cause problems: for t == 1 % See error m...

9 years ago | 0

Answered
How to keep GUIDE created window on top (or even call it)
When I update any Figure it gets called to the foreground. Why? This might mean, that you are using |figure(handles.hFigure...

9 years ago | 0

Answered
Speeding up algebraic operations ( .* and .^ )
With Matlab >= R2016b, you can write PEGM2 .* repmat(util_ap(:,:,:,:,:,2),1,1,1,1,1,3) as PEGM2 .* util_ap(:,:,:,:,...

9 years ago | 2

Answered
Warning message: Erase mode property no longer supported!!
Simply omit the 'Erasemode','none' in your code and do not delete the created line afterwards.

9 years ago | 1

| accepted

Answered
dbstop if error stops in "drawnow"
|drawnow| stops with an error, if a graphic object has been created, which cannot be displayed correctly, e.g. a listbox with th...

9 years ago | 0

| accepted

Answered
Buttons to a matrix
It is "relative" simple - depending on how you define "simple". Use either GUIDE or programmatically. Both methods have advan...

9 years ago | 1

Answered
random choice of elements for n times, without choosing the same element more than once
Perhaps you mean: for i = 2: ntrials C = letters(randperm(length(letters), nletters)) end Do you want to store t...

9 years ago | 3

| accepted

Answered
Split column full of numbers based on known "Symbol or word"
If you mean text files as input and output: Str = fileread(FileName); CStr = strsplit(Str, '\n'); CStr = reshape(CSt...

9 years ago | 2

Answered
Loop in structure or cell array
You have 2000 matrices in your workspace?! This is a bad idea. Names like "Trace_1_1_30_1_1" hide important information in the *...

9 years ago | 1

Answered
How to slice 2d matrix based on a vector of indices of each row?
A = [1,2,3,4; 5,6,7,8; 9,10,11,12]; B = [2,1,4]; C = A(sub2ind(size(A), 1:3, B)) |sub2ind| creates the "linear index"...

9 years ago | 1

| accepted

Answered
Struct contents reference from a non-struct array object.
I guess, that the error occurs in <https://www.mathworks.com/help/nnet/ref/trainbr.html trainbr>. Read the documentation for thi...

9 years ago | 0

Answered
Does it exist a function which is similar to time() function of C ambient ?
The number of seconds of the current day: s = rem(now, 1) * 86400; Number of seconds since 17-Mar-2011: s = (now - ...

9 years ago | 0

| accepted

Answered
How To Write Long Plot Handle
What about: axes('NextPlot', 'add'); % or : hold('oll') h = gobject(1, n); for k = 1:n h(k) = plot3(coll{k}(:,...

9 years ago | 1

| accepted

Answered
Does the license file need to remain on the client machine after licensing?
The license file is used at each startup of Matlab. A simple solution would to uninstall Matlab, when the person leaves the o...

9 years ago | 0

Answered
Error: Invalid MEX file, the specified module could not be found
Maybe using the DependencyWalker helps to find out, which modules are missing: <https://www.mathworks.com/matlabcentral/answers/...

9 years ago | 0

Answered
sir i am getting this error : Attempt to reference field of non-structure array. when i run this code.
Obviously you use a dot to reference a field, but the variable is not a struct. Use the debugger to find out, which variable ...

9 years ago | 0

Answered
How to define several variables from vector at the same time
[a, b, c] = deal(x(1), x(2), x(3)) I am not sure that this is "cleaner", if you do this for many variables. It is slightly ...

9 years ago | 1

| accepted

Answered
Diary problem in Linux Console
Because "< hello.m" pipes the contents of the file to the Matlab console. because it appears there, you find it in the diary als...

9 years ago | 1

| accepted

Answered
Mex error cl : Command line error D8027 cannot execute c1.dll
You will find many instruction how to install the SDK 7.1 under Windows 10, if you search in the forum: <https://www.mathwork...

9 years ago | 0

| accepted

Answered
Not same fprintf MATLAB and Linux Console
If you write the message to stderr by fprintf(2, '%s\n', errorMessage1); you have to catch this channel also. Try: ...

9 years ago | 1

| accepted

Answered
How to use wrapTo2Pi in user defined function which will be solved by ode45?
ODE45 cannot handle discontinuities. The step size controller will either stop the integration with an error or even worse reduc...

9 years ago | 0

Answered
Functional form of the colon (:) operator?
What's wrong with: y = x(:) or: reshape(x, [], 1) There is a functional form of the x(:) operator: subsref(...

9 years ago | 0

Solved


Swap two numbers
Example Input: a = 10 b = 20 Output a = 20 b = 10

9 years ago

Load more