Answered
why in this function they use empty square brackets?
A(i,:) = []; This deletes the i.th row of the matrix A. Example: A = [1,2,3; 4,5,6; 7,8,9]; A(1, :) = [] % A = [4,5,6; 7,...

4 years ago | 2

Answered
Open to feedback for my code
[] is Matlab's operator for a concatenation. [0.05] concatenates the numnbre 0.05 with nothing, therefore this is a waste of tim...

4 years ago | 0

| accepted

Answered
Help with a loop that computes at each step
hs = [0.05, 0.05/2, 0.05/4, 0.05/8, 1/1000]; for k = 1:numel(hs) h = hs(k); N = totalDuration / h; % ??? y = y...

4 years ago | 0

| accepted

Answered
How to call functions from inside an if statement only once?
I'm not sure if I understand you correctly, but maybe: for tt = 2: 50 ... if tt > 2 || M(tt) >= 0.3 * N [G_dmg, ~] =...

4 years ago | 0

Answered
change in xlrange of xlsread while sing loop
Why do you want to import ranges at all? Import the complete file as a matrix or table and filter out the needed values by somet...

4 years ago | 0

Answered
Invalid expression. When calling a function or indexing a variable
You cannot use constants in the definition of the inputs of a function: function [e L] = dijkstra(datos,1,12) % ...

4 years ago | 1

Answered
How to trace the end point of my vector without losing other plots?
Do not delete obejcts and draw new ones, but keep the obejcts and modify the coordinates. If nothing is deleted, it is easy to k...

4 years ago | 0

Answered
Error using mex Access denied; check that you have permissions to access.
Without Admin privilges you cannot write to the Programs folder - and this is a good idea. Copy the file mexGPUExample.cu from ...

4 years ago | 0

| accepted

Answered
For-loops are now faster than some of the simplest vectorized statements. Why do we still need so much deep copying?
I have heared the moaning in the net, that Matlab processes loops very slow. Then MathWorks has introduced the JIT acceleration ...

4 years ago | 1

Answered
How to stop display of variable type in command window?
If you want the output as in old Matlab versions, you have to use old Matlab versions. To control the output, use specific func...

4 years ago | 0

Answered
Trying to create an interpolation function where Matlab asks me for value inputs.
function Y = Interpolation (X,x1,x2,y1,y2) Y = y1 + (X-x1) * (y2-y1) / (x2-x1); end Now provide the input arguments as inputs...

4 years ago | 0

Answered
Matlab structure of struct
MyStruct = cell2struct(cell(2, 1), {'field1'; 'field2'}) Now the fields exist, but contain empty matrices only.

4 years ago | 1

| accepted

Answered
How to get the value of (V ) , using Mathlap of matrix (Write the code in step).
% V = Y \ I Y = [-12.576i, 5i, 0, 6.667i; ... 5i, -12.5i, 5i, 2.5i; ... 0, ...

4 years ago | 1

Answered
How to stop particles crossing the solid cylinder boundary
What about: Outcircle = ((x_out - x_c(j)).^2 + (y_out - y_c(j)).^2) >= (D/2)^2; x_out(Outcircle) = x_previous(Outcircle); y_o...

4 years ago | 0

Answered
Too many open files. Close files to prevent MATLAB instability.
Yes: call fclose(fid) after the data are imported. The operating system limits the number of files, which can be open simultane...

4 years ago | 0

| accepted

Answered
Is there a safe version of `run`?
No, this is not possible. There is always a trick to use str2func to call eval , which executes a string, which is decrypted dur...

4 years ago | 0

Answered
How can I contact the Exchange Admin?
Use the "Contact Us" button. The categories do not really match your problem, but simple choose some almost matching details and...

4 years ago | 0

| accepted

Answered
Size of compressed image is larger than image .... How to solve this problem?
If the original image was written with a low quality, the default Quality=75 of imwrite might increase the file size.

4 years ago | 0

Answered
Any onr can help me
% Sum of i (i = 1:n): s = n * (n+1) / 2 Gauss is faster and easier. % Your solution: y = 0; for k = 0:n y = y + ((n/k)...

4 years ago | 0

Answered
Improving MATLAB programme to make it Run faster
In Matlab online one iteration needs about 3 seconds. for gamma_by_L = 0.01:0.1:5 for beta_by_L = 0.1:0.1:5 for alpha_...

4 years ago | 0

| accepted

Answered
what correction is required in the code?
A hint: You want to perform this: s = 0 s = s + 2*2 s = s + 2*5 s = s + 5*8 You need to loop over the indices of m. There i...

4 years ago | 0

Answered
How do I find f(x) if I have this definition
You have given the formula already: Create a sum from n=1:m over: (-1)^n * x^(2*n + 1) / factorial(2*n + 1) These are all term...

4 years ago | 0

| accepted

Answered
Read the content of last text file in the given directory
Obtain a list of file names at first: Folder = 'C:\Your\Folder'; List = dir(fullfile(Folder, '*.txt')); FileName = {Lis...

4 years ago | 0

Answered
I have an array and I want to check if any of the array elements doesn't satisfy a certain condition.
A = [ 5 8 1 2 7 9 6]; isLowerThan3 = A < 3 A(isLowerThan3)

4 years ago | 1

| accepted

Answered
Double or single quotes for `add_line` function?
In the documentation doc add_line you find the explanation, that the inoput arguments are "character vectors". This means, that...

4 years ago | 0

Answered
Modify built-in Matlab function without overwriting it
You want to runs the code on a different computer also. Then using a modified copy of the file an all its depenedencies is not a...

4 years ago | 0

| accepted

Answered
transfer of licence from a old pc to a new pc
Yes. Open your license center: https://www.mathworks.com/mwaccount/ Click on the concerned license (the number in the table un...

4 years ago | 1

| accepted

Answered
vertically aligned data using fprintf
Use the width in the format specifier data = [1 0 -0.828 -1.909 -0.974; ... 1 300 -0.838 -...

4 years ago | 1

| accepted

Answered
Why y6(x)=e^[(-ax)]^2 didin't work
Welcome to Matlab! "It doesn't work" is not a useful description of the occuring problem. Post the error message instead or exp...

4 years ago | 1

Answered
Error using bitxor Inputs must have the same size.
The mistake happens here: [M,N]=size(original); The original image is an RGB image, not a grey-scale image as the comments imp...

4 years ago | 0

| accepted

Load more