Risposto

Plot line doesn't follow function

You determine the corret values, but draw them in random order. Sorting cleans the diagonalish lines: x_total = zeros(1, 1000...

Plot line doesn't follow function

You determine the corret values, but draw them in random order. Sorting cleans the diagonalish lines: x_total = zeros(1, 1000...

3 mesi fa | 0

| accettato

Risposto

How do I create a random number generator using congruent method

A very cheap linear congruential RNG with parameters suggested by Knuth: function a = rng_cheap % On-line Numerical Recipes in...

How do I create a random number generator using congruent method

A very cheap linear congruential RNG with parameters suggested by Knuth: function a = rng_cheap % On-line Numerical Recipes in...

3 mesi fa | 0

| accettato

Risposto

Problems running the code in Mac

This will not run on a PC also. If M_.param_names is a 54x8 char, you cannot use braces for indexing, because they work for cell...

Problems running the code in Mac

This will not run on a PC also. If M_.param_names is a 54x8 char, you cannot use braces for indexing, because they work for cell...

3 mesi fa | 0

| accettato

Risposto

Error in saving data

As the message tells you: Use a MAT file version 7.3 . You can find instructions by doc save. save('File.mat', 'YourVariable', ...

Error in saving data

As the message tells you: Use a MAT file version 7.3 . You can find instructions by doc save. save('File.mat', 'YourVariable', ...

3 mesi fa | 1

Risposto

How to index variables in two combined function for overwriting data

With some bold guessing: X0 = 1.5; Y0 = 1.5; Z0 = 3.0; Theta0 = 30; Phi0 = 90; K = 4; X = [X0 zeros(1,K)]; Y = [Y0 zeros...

How to index variables in two combined function for overwriting data

With some bold guessing: X0 = 1.5; Y0 = 1.5; Z0 = 3.0; Theta0 = 30; Phi0 = 90; K = 4; X = [X0 zeros(1,K)]; Y = [Y0 zeros...

3 mesi fa | 0

| accettato

Risposto

repeat the code with different value each time

w = rand(6, 222); index = 1:6:size(w, 2); result = zeros(1, numel(index)); for k = 1:numel(index) aw = w(:, index(k):ind...

repeat the code with different value each time

w = rand(6, 222); index = 1:6:size(w, 2); result = zeros(1, numel(index)); for k = 1:numel(index) aw = w(:, index(k):ind...

3 mesi fa | 0

| accettato

Risposto

my error in the write n!+1 = 0 mod n

nq=factorial(n(i)))+1; % ^ Here are more closing then opening parentheses. Whenever you mention an error in t...

my error in the write n!+1 = 0 mod n

nq=factorial(n(i)))+1; % ^ Here are more closing then opening parentheses. Whenever you mention an error in t...

3 mesi fa | 1

Risposto

The code works but it gives this warning. How to remove this warning?

You call the function L2_Array in ByAskic.m with the arguments 6 and 10. Inside L2_Array you calculate N_on_each_axis = (N-1)/...

The code works but it gives this warning. How to remove this warning?

You call the function L2_Array in ByAskic.m with the arguments 6 and 10. Inside L2_Array you calculate N_on_each_axis = (N-1)/...

3 mesi fa | 1

Risposto

How can I separate data into multiple groups?

data = [2416.015, 127.402, 382.165, 127.425, 127.3387, 127.406, 637.001, 127.405, 2240.913, ... 2257.54, 241.801, 3064....

How can I separate data into multiple groups?

data = [2416.015, 127.402, 382.165, 127.425, 127.3387, 127.406, 637.001, 127.405, 2240.913, ... 2257.54, 241.801, 3064....

3 mesi fa | 0

Risposto

What can we do with the thread "license-manager-error-9"?

From a discussion in the comments on the concerned page: Jestzer on 28 Feb 2023 at 23:32 This is already in the answer. Why di...

What can we do with the thread "license-manager-error-9"?

From a discussion in the comments on the concerned page: Jestzer on 28 Feb 2023 at 23:32 This is already in the answer. Why di...

3 mesi fa | 0

Risposto

Not enough input argument for GUI

"Not enough input arguments" mean, that you call a function with less input arguments that needed. This line; [tsol,xsol] = od...

Not enough input argument for GUI

"Not enough input arguments" mean, that you call a function with less input arguments that needed. This line; [tsol,xsol] = od...

3 mesi fa | 0

| accettato

Risposto

Using ODE45 with a matrix as input to my function

You can abbreviate: function dxdt = UseGamma(t,x,Gamma) Gamma y = Gamma*x; dxdt = zeros(size(x)); dxdt(1) = y(1); dxdt(2) ...

Using ODE45 with a matrix as input to my function

You can abbreviate: function dxdt = UseGamma(t,x,Gamma) Gamma y = Gamma*x; dxdt = zeros(size(x)); dxdt(1) = y(1); dxdt(2) ...

3 mesi fa | 0

| accettato

Risposto

How do I bugfix a builtin function? (How do I call a shadowed function?)

"I have 'DefaultFigureUnits' set to 'normalized' on my installation." - This is a bad idea which can and will cause unexpected b...

How do I bugfix a builtin function? (How do I call a shadowed function?)

"I have 'DefaultFigureUnits' set to 'normalized' on my installation." - This is a bad idea which can and will cause unexpected b...

3 mesi fa | 1

Risposto

How to test multiple values in my for and if statement.

x = 1:35; y = zeros(size(x)); c = 10400000 * 0.0013021; % Leaner code for k = 1:numel(x) if x(k) < 7 y(k) = (0...

How to test multiple values in my for and if statement.

x = 1:35; y = zeros(size(x)); c = 10400000 * 0.0013021; % Leaner code for k = 1:numel(x) if x(k) < 7 y(k) = (0...

3 mesi fa | 0

Risposto

how to make symmetric matrix with vector of its non repeated elements?

v = [1 4 5 6 9 0]; d = numel(v); n = (sqrt(8 * d + 1) - 1) / 2; % Number of rows and colums A = zeros(n, n); A(tril(true(...

how to make symmetric matrix with vector of its non repeated elements?

v = [1 4 5 6 9 0]; d = numel(v); n = (sqrt(8 * d + 1) - 1) / 2; % Number of rows and colums A = zeros(n, n); A(tril(true(...

3 mesi fa | 1

| accettato

Risposto

Vectorization of nested for loops

Your fixed code: a = linspace(40,45,5); b = linspace(90,95,5); idx = 1; for ii = 1:4 for jj = 1:4 c(idx, :) = ...

Vectorization of nested for loops

Your fixed code: a = linspace(40,45,5); b = linspace(90,95,5); idx = 1; for ii = 1:4 for jj = 1:4 c(idx, :) = ...

3 mesi fa | 0

| accettato

Risposto

Java Byte array to uint8 array

siz = size(Idata); Idata = reshape(typecast(Idata(:), 'uint8'), siz);

Java Byte array to uint8 array

siz = size(Idata); Idata = reshape(typecast(Idata(:), 'uint8'), siz);

3 mesi fa | 0

| accettato

Risposto

How to remove all volumes that only have zeros in them from a 5D array?

Start with using loops at first: data = randi([0, 1], [2, 10, 112, 240, 30]); % Some test data for i3 = 1:size(data, 3) ...

How to remove all volumes that only have zeros in them from a 5D array?

Start with using loops at first: data = randi([0, 1], [2, 10, 112, 240, 30]); % Some test data for i3 = 1:size(data, 3) ...

3 mesi fa | 1

Risposto

Dynamical plotting acceleration during loop calculation

Without seeing the code, it is hard to guess the reason of the slow down. I dare to guess boldly, that you insert new objects in...

Dynamical plotting acceleration during loop calculation

Without seeing the code, it is hard to guess the reason of the slow down. I dare to guess boldly, that you insert new objects in...

3 mesi fa | 1

| accettato

Risposto

access matlab figures by opening them with a mouse while a matlab terminal application is still running

This took 4 minutes for writing: function MainGUI FigH = figure('Name', 'Main GUI', ... 'MenuBar', 'none', ... ...

access matlab figures by opening them with a mouse while a matlab terminal application is still running

This took 4 minutes for writing: function MainGUI FigH = figure('Name', 'Main GUI', ... 'MenuBar', 'none', ... ...

3 mesi fa | 0

Risposto

I work on the project fake currency detection by MATLAB but I get a error i try to solve but i dont find solution

As I've written already, the problem is here: rectangle('Position',A(n, :), ' EdgeColor', 'r', 'LineWidth',4) % ...

I work on the project fake currency detection by MATLAB but I get a error i try to solve but i dont find solution

As I've written already, the problem is here: rectangle('Position',A(n, :), ' EdgeColor', 'r', 'LineWidth',4) % ...

3 mesi fa | 1

| accettato

Risposto

Fastest Way to Keep the last N Outputs of a Loop in a Matrix

If you do not know the number of iterations in advance, a circulare buffer is more efficient than shrinking an expanding an arra...

Fastest Way to Keep the last N Outputs of a Loop in a Matrix

If you do not know the number of iterations in advance, a circulare buffer is more efficient than shrinking an expanding an arra...

3 mesi fa | 0

| accettato

Risposto

Mean of every n number of doubles in a cell

I've reduced the test data size to 30x30 matrices - use the original sizes for your implementation: T = squeeze(num2cell(rand(3...

Mean of every n number of doubles in a cell

I've reduced the test data size to 30x30 matrices - use the original sizes for your implementation: T = squeeze(num2cell(rand(3...

3 mesi fa | 0

| accettato

Risposto

access matlab figures by opening them with a mouse while a matlab terminal application is still running

What does "make some plots" exactly mean? .fig-files? PNG-files with raster copies of diagrams? What is the reason that they can...

access matlab figures by opening them with a mouse while a matlab terminal application is still running

What does "make some plots" exactly mean? .fig-files? PNG-files with raster copies of diagrams? What is the reason that they can...

3 mesi fa | 0

Risposto

I keep getting a "convenc" error. Line 88. Could be "varargin" missing argument? Not sure.

The line is incomplete: encoded = convenc(msg,trellis,); % ^ ???

I keep getting a "convenc" error. Line 88. Could be "varargin" missing argument? Not sure.

The line is incomplete: encoded = convenc(msg,trellis,); % ^ ???

3 mesi fa | 0

Risposto

convert all .mat files to .wav format in a folder at once

No, this cannot work "at once", but one file after the other in a loop. See e.g. FAQ: How to process a sequence of files. It is...

convert all .mat files to .wav format in a folder at once

No, this cannot work "at once", but one file after the other in a loop. See e.g. FAQ: How to process a sequence of files. It is...

3 mesi fa | 0

Risposto

File too complex to analyze, function maybe too large?

Try a simplified version: Calculate the function directly instead of creating a huge function handle. Use constants for the mo...

File too complex to analyze, function maybe too large?

Try a simplified version: Calculate the function directly instead of creating a huge function handle. Use constants for the mo...

3 mesi fa | 0

Risposto

How to create a vector for multiple frames of data in rows and columns?

The actual question is: "I need to create a vector that corresponds to the time of each frame starting at 0" What about: t = l...

How to create a vector for multiple frames of data in rows and columns?

The actual question is: "I need to create a vector that corresponds to the time of each frame starting at 0" What about: t = l...

3 mesi fa | 0

Risposto

How to read a specially structured data file

[fid, msg] = fopen('test.5p'); assert(fid > 0, '%s', msg); C = fscanf(fid, '%g', inf); % Read all in one block fclose(fid); ...

How to read a specially structured data file

[fid, msg] = fopen('test.5p'); assert(fid > 0, '%s', msg); C = fscanf(fid, '%g', inf); % Read all in one block fclose(fid); ...

3 mesi fa | 2

Risposto

how to reduce the size of array as small as the smallest array to have them in one matrix

There are several possibilities: Fill the shorter arrays with zeros or NaNs on the top, bottom or both. Crop the longer arrays...

how to reduce the size of array as small as the smallest array to have them in one matrix

There are several possibilities: Fill the shorter arrays with zeros or NaNs on the top, bottom or both. Crop the longer arrays...

3 mesi fa | 0