Answered
how can i integrate a function?
As soon as you write the formula a function instead of an anonymous function, you can debug it: % Create anonymous function...

9 years ago | 0

| accepted

Answered
Remote Developing with Matlab
This would be trivial using a remote desktop, e.g. Windows RDP service, VLC, TeamViewer, Chrome Remote Desktop, etc. Then you ar...

9 years ago | 0

Answered
how to calculate the probability of each element in string
Although Huffman encode works on "strings", you can apply it to numbers also, of course. |histcounts| will be usual for your pur...

9 years ago | 0

| accepted

Answered
why is the anonymous function slower than a function call
Some ideas: # You call it as last branch of the |switch| cases. This needs addition time for 3 comparisons. # You do not onl...

9 years ago | 0

| accepted

Answered
Use of dir - too slow!
Do you have any evidence that |dir| is the time consuming command? This is not likely, but it could happen if you work on a netw...

9 years ago | 0

| accepted

Answered
ode 45 giving the wrong solution
why the ode command fails and giving me the wrong plot You did not show us your "ode command". Your function to be integr...

9 years ago | 1

Answered
How can I repeat the previous state of the random generator?
In theory it is possible to determine the previous state if you know the current one, because the random number generator is a s...

9 years ago | 0

Answered
change the dimension of multidimensional matrix
I do not understand the question. You have a 16 x 64 matrix and want to get a 100 x 64 x 2 matrix. 100 is not a multiple of 16, ...

9 years ago | 0

Answered
Maximum value of a vector during specified intervals of time
DateV = datevec(dn); Index = (3 <= DateV(:, 2) & DateV(:, 2) <= 5); P = max(reshape(Q(Index), [], 88));

9 years ago | 0

| accepted

Answered
How can I use plot function to draw lines with diferent width in a figure?
figure, plot(EjeX, EjeY1(:,1), 'b'), grid; hold on; plot(EjeX, EjeY1(:,1), 'm', 'LineWidth', 3); plot(EjeX, EjeY1(:,2), ...

9 years ago | 0

Answered
How can I correct my function?
Call it from another script or function or from the command window: center = 23; radius = 5; [x, y] = getCircle(cente...

9 years ago | 0

Answered
How do I rotate a 2 dimensional shape using my computer's arrow keys?
You find some examples of catching the currently pressed key in the FileExchange: <https://www.mathworks.com/matlabcentral/filee...

9 years ago | 0

Answered
move all zeros to the right in a matrix
X = [1,2,3,0; 0,0,0,1; 8,0,9,0; 4,3,2,1]; [c, r] = size(X); [~, S] = sort(X == 0, 2); Index = sub2ind(size(X), rep...

9 years ago | 1

Answered
Import csv files with sequential names
See <https://www.mathworks.com/matlabcentral/answers/57446-faq-how-can-i-process-a-sequence-of-files FAQ: Import sequence of fil...

9 years ago | 0

| accepted

Answered
How can I transform scores (eg. transform 1 to 5 and 5 to 1)?
Or with a lookup table: evals = [5 2 2 5 4 3 4 3]; lut = 5:-1:1; result = lut(evals);...

9 years ago | 0

Answered
how to delete this error?
Error: Function definitions are not permitted in this context. This means, that you either try to create this function in th...

9 years ago | 1

Answered
Can I do a full install of all Mathworks products and then control usage by the license file?
This should be trivial by using a license, which includes all toolboxes. So please explain, which problem you have.

9 years ago | 0

Answered
How can I get the name of a MATLAB variable as a string?
Try to avoid this whenever it is possible. The _names_ of the variables should not carry important information. If names really ...

9 years ago | 8

Answered
How to preallocate a matrix and fill it with a function of two vectors?
Start with: v = 0:5:55; t = (-20:5:55).'; Then use this as input to your function: X = v .^ 2 + sin(t); % O...

9 years ago | 0

Answered
Why, when I pass a structure S into a function, and assign or update more fields to it, does it remove the fields it had when entering the function?
function main S.a = 1; S.b = 2; S = function_name(S); disp(S) end function S = function_name(S) S.c =...

9 years ago | 0

Answered
Merging 4th column multiple text files into one file
Folder = 'C:\Your\Folder'; DirList = dir(fullfile(Folder, '*.txt')); OutFID = fopen(fullfile(Folder, 'Output.txt', 'w'...

9 years ago | 0

Answered
Converting date string to number
S = '01-Jul-1980 00:00:00'; datenum(S) % Old datetime(S) % Modern

9 years ago | 0

Answered
Can I use the input function to ask for both a number or a string?
You can use |input| to obtain a string in every case and interpret as string or number as you like it. Note that if the user typ...

9 years ago | 0

Answered
matrix multiplication with probability
Maybe: A = [1 0.5 1; 0.6 0.3 0.4; 0.4 0.5 1]; for k = 1:10 a = rand; B = A * a; ... end

9 years ago | 0

Answered
Error using for loop
Posting a simplified version of the real failing code has the disadvantage, that the actual problem might be concealed. Use ...

9 years ago | 0

Answered
How to count the number of consecutive identical elements (in both the directions) in a binary vector ?
With <https://www.mathworks.com/matlabcentral/fileexchange/41813-runlength FEX: RunLength>: X = [0 0 0 0 ...

9 years ago | 9

| accepted

Answered
How do I plot acceleration from my ODE45 function?
Modify the function to be integrated such, that it accepts a matrix as input y: function ydot=func(t, y) k = 1000; ...

9 years ago | 0

| accepted

Answered
how can i run spam toolbox ?
The readers cannot guess, which toolbox you are talking of. Maybe: <https://github.com/gnebehay/SCM/tree/master/spams-matlab> ? ...

9 years ago | 0

Answered
How do I make a file name with combination of two strings ?
folder = 'D:\Temp'; str1 = 'aaa' str2 = 'bbb' % Alternatives: name = [str1, str2] name = st...

9 years ago | 2

| accepted

Answered
How can I find a matrix which is orthogonal to another matrix?
Maybe you mean the QR decomposition: A = [1,2; 2,3; 3,4] [Q, R] = qr(A) Now Q is an orthogonal matrix, or in other wo...

9 years ago | 0

Load more