Beantwortet
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,...

fast 5 Jahre vor | 2

Beantwortet
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...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
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...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
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, ~] =...

fast 5 Jahre vor | 0

Beantwortet
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...

fast 5 Jahre vor | 0

Beantwortet
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) % ...

fast 5 Jahre vor | 1

Beantwortet
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...

fast 5 Jahre vor | 0

Beantwortet
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 ...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
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 ...

fast 5 Jahre vor | 1

Beantwortet
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...

fast 5 Jahre vor | 0

Beantwortet
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...

fast 5 Jahre vor | 0

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

fast 5 Jahre vor | 1

| akzeptiert

Beantwortet
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, ...

fast 5 Jahre vor | 1

Beantwortet
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...

fast 5 Jahre vor | 0

Beantwortet
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...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
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...

fast 5 Jahre vor | 0

Beantwortet
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...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
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.

fast 5 Jahre vor | 0

Beantwortet
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)...

fast 5 Jahre vor | 0

Beantwortet
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_...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
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...

fast 5 Jahre vor | 0

Beantwortet
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...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
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...

fast 5 Jahre vor | 0

Beantwortet
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)

fast 5 Jahre vor | 1

| akzeptiert

Beantwortet
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...

fast 5 Jahre vor | 0

Beantwortet
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...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
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...

fast 5 Jahre vor | 1

| akzeptiert

Beantwortet
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 -...

fast 5 Jahre vor | 1

| akzeptiert

Beantwortet
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...

fast 5 Jahre vor | 1

Beantwortet
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...

fast 5 Jahre vor | 0

| akzeptiert

Mehr laden