Beantwortet
imwrite does not work when file extension is given
Do not use "path" as name of a variable, because this shadows an important Matlab command. This does run usually, but during deb...

mehr als 5 Jahre vor | 0

| akzeptiert

Beantwortet
Finding an average matrix from each matrix in an array
Which kind of array contains the matrices? A cell array, a numerical 3D array, a struct array? The solution depends on this deta...

mehr als 5 Jahre vor | 1

Beantwortet
How can I use funtions defined in a column vector individually?
A small modification of your code let accept RK4 vector functions also: function [t, y] = RK4(fun, t0, tN, h, y0) t = t0:h:...

mehr als 5 Jahre vor | 1

| akzeptiert

Beantwortet
Merging several mat files in a row order
You did not explain, how a list of the files names can be obtained. I guess, that they can be found in the same folder: Folder ...

mehr als 5 Jahre vor | 1

Beantwortet
guidata(hObject, handles) does not save my data
How did you create the GUI? This does not look as GUIDE. How are the callbacks called? Directly as defined during the creation o...

mehr als 5 Jahre vor | 0

| akzeptiert

Beantwortet
Command for saving .M files ?
Name = 'file1.m' Doc = matlab.desktop.editor.findOpenDocument(Name); if Doc.Editable Doc.save; end

mehr als 5 Jahre vor | 2

Beantwortet
convert from cell of characters to the equivalent double number
array = {'G',[]; 'E','H'; 'B','J'; 'A','C'; 'D','F'}; array(cellfun('isempty', array)) = {char('A' - 1)}; array2 = cell2mat(a...

mehr als 5 Jahre vor | 0

| akzeptiert

Beantwortet
Smart for loop for summing cell array matrices
Yes, this does, what you expect. Simply compare the results of both methods. This is faster and looks cleaner: for RIPETIZIONE...

mehr als 5 Jahre vor | 1

Beantwortet
Why does resetting a 0x0 cell property value result in 0x1 cell?
If we cannot see the reset function, there is no chance, that we can guess, how the {0x1} cell is created. You could add a test...

mehr als 5 Jahre vor | 0

Beantwortet
Convert 'str' to 'number'
str = 'P12teta4'; a = str(1); b = sscanf(str(2), '%d'); c = sscanf(str(3), '%d'); ind = find(isstrprop(str(4:end), 'digit'),...

mehr als 5 Jahre vor | 0

Beantwortet
Help Fixing Leap Year Function
Use the standard notation and no neat accumulation of commands per line: function LeapYears condition = "yes"; while strcmp(...

mehr als 5 Jahre vor | 1

| akzeptiert

Beantwortet
speeding up using cellfunction and arrayfun versus for-loop
The question is not clear. Please post some code, which reproduces your measurements. There are several details in your code, ...

mehr als 5 Jahre vor | 0

| akzeptiert

Beantwortet
How can i make a 2D convolution with x = [1 0 2; -1 3 1; -2 4 0] and h = [1 -1; 0 2] and not use conv2? Can you please help me.
Look at the definition of the convolution again. Either the orientation of h or the submatrices of x must be changed: [h1, h2]...

mehr als 5 Jahre vor | 0

Beantwortet
How to find inf and sup of a datum not contained in an array ?
x = randi([1, 100], 1, 30); y = 1 + rand * 99; [~, index] = min(abs(x - y)); indexBefore = max(1, index - 1); indexAfter ...

mehr als 5 Jahre vor | 0

Beantwortet
How to put in a condition from if/ifelse statements in a fprintf string.
january21 = [74 60 54 61 54 57 49 41 37 45 45 38 42 58 55 48 55 56 55 ... 55 55 57 60 65 72 71 60 48 56 60 70]; temp = jan...

mehr als 5 Jahre vor | 0

| akzeptiert

Beantwortet
How can i solve this "Matrix dimensions must agree" error?
omega(:, :, i + 1) = omega(:, :, i) + 10 * x_hat2(:, i) * conj(e(i))'; This works since Matlab R2016b due to the auto-expanding...

mehr als 5 Jahre vor | 0

Beantwortet
Why all the code in a MATLAB program are just functions
"No function code" is code written to a "script". Scripts share their workspace (the list of loclly used variables) with their c...

mehr als 5 Jahre vor | 1

| akzeptiert

Beantwortet
How can I vectorize the fun in Matlab with single code
Vectorize the bottleneck of the code manually. There is no automagic command, which can do this for you efficiently.

mehr als 5 Jahre vor | 0

Beantwortet
for loop over subset - finding indices vs if-clause
It depends. How expensive is "fulfill CONDITION"? Simply try it. Implement both versions and measure the timings with tic/toc. ...

mehr als 5 Jahre vor | 1

Beantwortet
Not enough input arguments (ideal=abs(r-D)>W/2;)
You have copied the HTML key ">" instead of of the actual character > . Then "gt" is interpreted as ">=" operator but the rig...

mehr als 5 Jahre vor | 0

Beantwortet
Can you pass same values along a chain of multiple functions?
The CamelCase or sulkingCamelCase is a convention only, which can help to keep the overview. The Matlab code runs fine without u...

mehr als 5 Jahre vor | 2

| akzeptiert

Beantwortet
I have difficulty to install Matlab to my PC whose os is Windows 7
Matlab 2021a is supported for Windows 7 sp1: https://www.mathworks.com/support/requirements/matlab-system-requirements.html I...

mehr als 5 Jahre vor | 0

Beantwortet
Which one is the correct one to calculate
R = 0; L = 30; % Some educated guesses q = rand(1, L); lambda = rand(1, L); alpha = rand; dt = rand; for j...

mehr als 5 Jahre vor | 0

| akzeptiert

Beantwortet
Missing figures in MATLAB script
There is this brute clearing line in the middle of your code: clear all, clc, close all Of course it clears all variables and ...

mehr als 5 Jahre vor | 2

| akzeptiert

Beantwortet
Trying to solve an ode using Heun's method but getting an error
Slope_left = (1+4*x)*sqrt(y) Because x is a vector, Slope_left will be a vector also. At least in the 1st iteration. In later i...

mehr als 5 Jahre vor | 0

Beantwortet
Command use to convert expression E to numeric form
Maybe you mean the output to the command window? format short pi * 1e8 format long pi * 1e8 format long g pi * 1e8 You ha...

mehr als 5 Jahre vor | 0

Beantwortet
Looping between two functions
Simplify your code: for i=1:hsd kas(i)=wqe(i); sak(i)=kli(i); cbb(i)=bbc(i); end does the same as: kas = w...

mehr als 5 Jahre vor | 0

Beantwortet
How to solve this issue Variable 'X' is not fully defined on some execution paths.
Insert a definition of CONDICIONTRAMO = -1 (or NaN, or 12) either on top of the code, before the IF branchs, or in a finaly else...

mehr als 5 Jahre vor | 0

| akzeptiert

Beantwortet
When using "Pause on Warning/Error," is there a way to avoid breaking into built-in functions?
Matlab cannot guess in which level you want to display the call stack. So either select it manually, or use try/catch/rethrow fo...

mehr als 5 Jahre vor | 0

| akzeptiert

Beantwortet
Sizeof double float int etc
Version 1: w = whos('z'); nbytes = w.bytes; Version 2: function S = sizeof(X) switch class(X) case {'uint64', 'in...

mehr als 5 Jahre vor | 0

| akzeptiert

Mehr laden