Beantwortet
How to read xlsx file with displayed precision of decimals
The problem is not trivial. Notice that e.g. "3.50" can have the stored value "3.4999999999999999". This is smaller than 3.5, bu...

mehr als 4 Jahre vor | 0

Beantwortet
Multiplying two vectors to form a matrix
z = sqrt(x .^ 2 + y.' .^ 2) But, of course, this does not match "multiply them". If you want a multiplication: x .* y.' [ED...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
how to remove columns from a 3D array, considering user input
Either use square brackets for the input: b = input('Indices enclosed in square brackets: '); % Type in: [1,5,7] Or input a s...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
how to do a for cycle for cell arrays
And the next question concering indices hidden in the names of variables. Use an array instead. In your case, data2 is sufficie...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
how to use a for cycle with strings as variables
As soon as you do not hide indices in the names of variables, but use arrays instead, the code is trivial: for k = 1:10 writ...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
Using an external array in ode45
This cannot work for several reasons: ODE45 is designe to integrate smooth functions with a certain accuracy. Using non-smooth ...

mehr als 4 Jahre vor | 1

| akzeptiert

Beantwortet
How to get the correct answer for LU Decomposition with partial pivoting?
You forgot to apply the permutation matrix P to b. The results are correct: P * L * U - A % == zeros, fine b = P * b; Then ...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
searching first two consecutive ones and set to 0
y = [0 0 1 1 1 1 1 1 1 1 1]; index = strfind(y, [1, 1]); if any(index) y(index(1):index(1)+1) = 0; end y

mehr als 4 Jahre vor | 0

Beantwortet
Apply logical mask to every matrix in array
B = reshape(1:24, 2,3,4); mask = logical([1,0,1; 0,1,0]); sB = size(B); B = reshape(B, [], sB(3)); % Join the first tw...

mehr als 4 Jahre vor | 0

Beantwortet
define a pattern to use with dir and get the file names containing numbers
This does not work with the patterns of the operating system. Use a regexp call to filter the names instead: List = dir('*.t...

mehr als 4 Jahre vor | 1

| akzeptiert

Beantwortet
Suppressing outputs (ans) in MATLAB
You need a semicolon after the call of the function: paths = CEVPaths(S,r,q,vol0,beta,T,N,NPaths); % ...

mehr als 4 Jahre vor | 1

Beantwortet
i want to double titles in one graph
This works using the text() command.

mehr als 4 Jahre vor | 0

Beantwortet
Error using second . Invalid date/time class. (I am working on guide)
A bold guess: persistent timein if x >= p_x(1) && x <= p_x(2) && y >= p_y(1) && y <= p_y(2) timein = datetime('now'); ...

mehr als 4 Jahre vor | 1

Beantwortet
want a rows to split into multiple rows
X = ones(1, 90); Y = reshape(X, 3, []); % 2nd argument is determined automatically % The long form: Y = reshape(X, 3, nume...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
invalid index in program
Use the debugger to examine the cause of problems. Type this in the command window: dbstop if error Run the code again until i...

mehr als 4 Jahre vor | 0

Beantwortet
MATLAB R2021b error running installer
What does the event viewer tell you about the occurring problems? Do you try to run the installer from the protected download f...

mehr als 4 Jahre vor | 0

Beantwortet
How do I find the mean of certain parts of a cell array?
This is easy, if you store the values in a numerical array instead of a cell. Why do you prefer a cell array? But you can creat...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
If value in one vector is in another, assign the value of the other column of the second vector to a third
I do not understand exactly, what you are asking for. A guess: T = 0:20; s = zeros(1, numel(T)); stimuli = [4 8 14 2 16 6 15 ...

mehr als 4 Jahre vor | 0

Beantwortet
the length of the time span in ode45
The small discretization and rounding errors accumulate over the time. Small deviations of the initial values can be amplified a...

mehr als 4 Jahre vor | 1

| akzeptiert

Beantwortet
sort 4th dimension of a 4D matrix with indexing
Maybe you mean: for i=1:83 % vols(:,:,:,i)=vols_sorted(:,:,:, bSortIdx(i)); vols_sorted(:,:,:,i) = vols(:,:,:, bSortI...

mehr als 4 Jahre vor | 1

| akzeptiert

Beantwortet
Trying to get the user to input consecutive values
for i = 1:length(Rtot) If Rtot is a scalar, the loop runs one time only. I guess you want: for i = 1:Rtot The message "What i...

mehr als 4 Jahre vor | 1

Beantwortet
I CODED THE PROGRAM BUT DON'T KNOW WHY STATEMENT IS NOT SHOWING, Using the singular value decomposition, prove that σ¯(AB) ≤ σ¯(A)¯σ(B)
The problem is: for i=10: size(A, 1) size(A, 1) replies 5. Then the loop from 10 up to 5 is not entered at all. Do you mean: ...

mehr als 4 Jahre vor | 1

| akzeptiert

Beantwortet
Write a function that gives a tree with one input
n = 9; disp(char(10 * (abs(-n+1:n-1) < (1:n).') + ' ')) Or with a function: affAbre(n) function affAbre(n) s = repmat(' '...

mehr als 4 Jahre vor | 0

Beantwortet
Vectorising Multiplying each column from a matrix with a square matrix and the tranpose of this column
Then please post you code. It is much faster on my computer: h = rand(2790, 3591); Pn = rand(2790, 2790); tic R = zeros(1,...

mehr als 4 Jahre vor | 0

Beantwortet
How to convert table to a csv file and save it in a remote location?
Folder = 'D:\Your\Folder'; File = [all_files(k).name(1:end-8) '_.csv']; writematrix(Stats, fullfile(Folder, File));

mehr als 4 Jahre vor | 0

| akzeptiert

Gesendet


WindowAPI
Set figure size, top-most, transparency and pixel mask, multi-monitor etc by Windows API

mehr als 4 Jahre vor | 6138 Downloads |

5.0 / 5
Thumbnail

Beantwortet
Generate a sine wave that has no stop-time
f = 5; a = 1; Fs = 1000; t1 = 1; figure; while 1 % Runs until you press Ctrl-c t = 0 : 1/Fs :t1-1/Fs; x =...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
Using number/counter instead of changing all variables names that end on same index
Do not hoide indices in the names of variables. This is a standard pitfall for beginners and discussed frequently. Use real indi...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
How to simplify code into a for loop?
M_diag = rand(4,4); C_diag = rand(4,4); K_diag = rand(4,4); a = phi(1:4, 1); q_f = a ./ (diag(M_diag) .* s .^ 2 + diag(C...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
TUTORIAL: Comma-Separated Lists and How to Use Them
An interesting application of comma-separated lists are dynamic indexing. You can use it to extract a specific dimension of a mu...

mehr als 4 Jahre vor | 2

Mehr laden