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

4 years ago | 0

| accepted

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

4 years ago | 0

Answered
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? ...

4 years ago | 0

Answered
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} ...

4 years ago | 0

| accepted

Answered
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"...

4 years ago | 0

| accepted

Answered
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'; ...

4 years ago | 0

| accepted

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

4 years ago | 0

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

4 years ago | 0

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

4 years ago | 0

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

4 years ago | 0

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

4 years ago | 0

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

4 years ago | 0

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

4 years ago | 2

| accepted

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

4 years ago | 0

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

4 years ago | 1

| accepted

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

4 years ago | 0

| accepted

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

4 years ago | 0

| accepted

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

4 years ago | 0

| accepted

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

4 years ago | 0

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

4 years ago | 0

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

4 years ago | 1

| accepted

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

4 years ago | 0

| accepted

Answered
"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...

4 years ago | 1

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

4 years ago | 1

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

4 years ago | 0

| accepted

Answered
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));

4 years ago | 0

Answered
1 == 0 ?
Replace if matrice(m,n) == 0 by if matrice(i,j) == 0 Currently you are checking the last element of the matrix in each itera...

4 years ago | 1

| accepted

Answered
Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To perform elementwise matrix powers, use '.^'.
This line is failing: i0_a = (i0_ref_a) * (Glucose_conc/Glucose_ref)^(gamma_anode); The error message contains some valuable h...

4 years ago | 0

| accepted

Answered
In the function datenum's formatin, does the 'HH' represent the same as 'hh'?
This is Matlab. Simply try it: test2=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 25]; newStr=num2str(test2');...

4 years ago | 0

| accepted

Answered
How to concatenate binary strings?
s = char('0' + randi([0,1], 8192, 8)); % Some test data r = reshape(s.', 32 * 8, []).'; % Create a 256 x 256 matrix

4 years ago | 1

Load more