Beantwortet
Mathworks: it's time for a dark theme.
A dark theme saves power on OLED screens only. I assume, that most computers run Matlab with LCD screens, which do not profit f...

mehr als 4 Jahre vor | 1

Beantwortet
problems with "if statement"
The if command is not a loop. What is the purpose if the "for k" loop? Its body does not depend on k, so you can omit this loop...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
how to get convolution for two signals without using conv command
If you read the documentation, you find the mathematical definition of conv: doc conv The code is easy to implement using loop...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
how to get adress position inside vector
Copied from my comment as an answer: gravlo = zeros(427,1); for iel = 1:5 g = G(:, iel); m = (g ~= 0); gravlo(g...

mehr als 4 Jahre vor | 1

| akzeptiert

Beantwortet
how to find a certain value in an array and return the value in the next column
A = [1 1.1; 2 2.2; 3 4.4]; x = 3; y = A(A(:, 1) == x, 2)

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
degrees2dms convertion anomally.
format long g dms = degrees2dms(35.55) This is a typical effect of the limited precision of doubles. Most decimal numbers cann...

mehr als 4 Jahre vor | 0

Beantwortet
Comparison of very large numbers
No, ismember does not round the values. Your assumption does not match the facts. Why do you think that a rounding is applied? ...

mehr als 4 Jahre vor | 0

Beantwortet
Compare array value to variable value
if x > array{1} && x < array{2} You need curly braces instead of round parentheses. array(1) is a {1 x 1} cellm while array{1} ...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
why does websave creates empty files?
path_to_save = "E:"; out_name_path = path_to_save+filename; This produces file names like "E:A_20080401_5.xml"...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
how can one specify a directory that websave saves files?
Using full path names is the reliable and efficient solution: Folder = 'C:\Your\Favorite\Folder'; File = 'AsYouWant.html'; ...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
How can I change in the directory while using dlmwrite?
I do not understand, what the problem is. The function tempname creates a file in your TEMP folder. Under Windows this is: C:\Us...

mehr als 4 Jahre vor | 0

Beantwortet
Error that does not make sense.
You can be completely sure, that the error occurs only, if the conditions are met. Matlab is not tired or evil, but a determinis...

mehr als 4 Jahre vor | 0

Beantwortet
System of equations with array inputs
Your file eqns_optimtax.m starts with the line: global Yc Yd An m file starting with code instead of the keyword "function" is...

mehr als 4 Jahre vor | 0

Beantwortet
How can I solve this error?
Omit the lines: clear all close all Note, that clear all deletes all loaded functions from the RAM and reloading them from th...

mehr als 4 Jahre vor | 0

Beantwortet
Why the results are different when use different letters?
Because the equations are different: syms rs xs rp xp syms a b c d [rp, xp] = solve(rs * rp^2 + rs * xp^2 == xp^2 * rp, xs...

mehr als 4 Jahre vor | 0

Beantwortet
How to adjust data
A bold guess: Maybe because you overwrite Yaxis(1,1) before? Yaxis(1,1) = Yaxis(1,2); Yaxis = Yaxis-Yaxis(1,1); Simpli...

mehr als 4 Jahre vor | 0

Beantwortet
Is there a way to obtain handles to the last N figures that were opened?
The list of children or the HG root object is reliable: function H = getLastFigs(N) H = get(groot, 'Children'); H = H(1:min(n...

mehr als 4 Jahre vor | 2

| akzeptiert

Beantwortet
sound is coming after the picture has disappeared
x = (rand(1, 70000) - 0.5) * 0.1; sound(x, 8000); pause(1) clear('sound'); % Undocumented The sound() command calls the m...

mehr als 4 Jahre vor | 0

Beantwortet
Integral of exponential- Incorrect result
Reduce the tolerances: format long fun = @(x) (((1e-5 * x) .^10) .* exp(-x / 1000)); xmin = 0; xmax = 40000E3; xint1 = int...

mehr als 4 Jahre vor | 1

| akzeptiert

Beantwortet
How to repeat elements of array in MATLAB
Replace: row(:,end+1:N)=0; by row(:,end+1:N) = row(1:size_MP);

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
Stop Matlab ignoring numbers
format long g This enables more visible digits. You get the complete control over the output format, if you use fprintf() inste...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
wait until picture selection.
You could add a button "Select this" to all open figures: function pushbutton15_Callback(hObject, eventdata, handles) openFig ...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
fread function for reading 10 bit raw file.
If the 10bit data are written as bitstream, 8 numbers use 10 bytes. If you read this as UINT8 or UINT16 does not matter: the seq...

mehr als 4 Jahre vor | 0

Beantwortet
If I start with a matrix of zeros, how can I easily create a Hypocycloid of ones in that matrix?
A point to start from - it is not hard to expand this to fill elements of the zero matrix: M = zeros(512, 512); a = linspac...

mehr als 4 Jahre vor | 0

Beantwortet
I need help in MATLAB code for general tan function with taylor series
Bn are the Bernoulli numbers: https://en.wikipedia.org/wiki/Bernoulli_number WikiPedia is the first point to start a search fo...

mehr als 4 Jahre vor | 1

| akzeptiert

Beantwortet
Removing part of file name (random numbers )
Names = ["A_m_T17__75788", "A_m_T18__63071", "A_m_T19__51148"]; Cleaned = extractBefore(Names, '__')

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
"Index exceeds the number of array elements"
The loop fails in the last iteration due to k(i+1). This requests k(T+2), which is not existing. So maybe this solves the proble...

mehr als 4 Jahre vor | 1

Beantwortet
Check if a value is within one of the cells in a cell array
Working with cells makes it harder. If you only want to know, if any 6 is contained: y = {[1,2],[2,3.51],[2,5],[2,6]}; T = any...

mehr als 4 Jahre vor | 1

Beantwortet
What is recommended way to store code snippets like utility functions?
Yes. Store the tools in their own folder, exactly as you can see it for Matlab's toolboxes. You can distinguish "tools", which s...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
plotting graphs in different figures with different domains
This opens 2 figures and draws 2 diagrams: figure; plot(1:10, rand(1,10)); figure; plot(11:20, rand(1,10));

mehr als 4 Jahre vor | 0

Mehr laden