Answered
What am I doing wrong when returning the value from the function to my loop?
% C++: % while (int sent = dfs(s, t, INF)) sent = dfs(s, t, INF); while sent ~= 0 sent = dfs(s, t, Inf); end And: %...

4 years ago | 1

| accepted

Answered
How to specify Hexadecimal Color Code on a fit line?
This is working in modern Matlab versions: plot(1:10, rand(1, 10), 'Color', '#A2142F') For older versions: color = uint8(ssca...

4 years ago | 1

Answered
i am getting an error in the following code ca some help to rectify ?
The code runs in the forum also, at least until: xlable('x-axis'); ylable('y-axis'); The commands are called "xlabel" and "yl...

4 years ago | 0

Answered
datetime InputFormat error in R2021b
I guess, that you have defined "datetime" as a variable by accident. datetime = timerange('12/18/2015 08:00:00', '12/18/2015 12...

4 years ago | 1

| accepted

Answered
Only Save the New Numerical Data to Text File
If you do not close a file opened by fopen with fclose is stays open. Solution: Append an fclose(fileid) after the fprintf.

4 years ago | 0

Answered
while loop for conditional statement
Maybe: array_data=33 x 1 % double window_size=10; m_BW=0.5; var_BW=0.5; i = 1; fin = window_size; while i <= fin m_B...

4 years ago | 0

| accepted

Answered
How can I assign values to a Structure with multiple subfields with one line of code?
You mention "as simple as possible". Then avoid unneeded operators e.g. by replaing: CellArr = {[1,2,3,4], [1:10], ['Man of Num...

4 years ago | 0

| accepted

Answered
How can I speed up image manipulation of a .fig?
Maybe. How is your OpenGL driver set up? opengl info Which Shading and Renderer in used in the figure? Can you provide the fi...

4 years ago | 0

Answered
For large arrays, Matrix rows carry onto next line theyre written in from a fortran program
Storing large blocks of data as source code is a bad idea. Text or binary files are much better. Matlab tries to be smart and l...

4 years ago | 0

| accepted

Answered
how to do manipulation with decimal numbers in array
This cannot work reliably. Remember, that most decimal numbers cannot be represented exactly in binary format. Therefor some num...

4 years ago | 0

| accepted

Answered
a run function gives an error due to size
Maybe: resultt = nan(10, 10); for bi = 1:10 r = birfazson(1, birfazson(2,:) == 1); if ~isempty(r) resultt(bi...

4 years ago | 0

Answered
Can I comment only a section or part of a line?
No, this is not possible in Matlab. It would be dangerous also, because it could move some code on the right side of the line o...

4 years ago | 1

| accepted

Answered
colon operator bug?
The colon operator works as expected. For integer values it does reply integers. But be aware of rounding effects for floating p...

4 years ago | 1

Answered
Loop through data-struct and its sub-structs; Trouble with 'indexing' - error
You want to use "dynamic field names". Then the field name must be included in parentheses: x = DATA.(fn{N}).second-field.colum...

4 years ago | 0

| accepted

Answered
Anonymous function arguments and parameters extrction
pu = @(x, y) [x,y]; a = pu(1, 2:3) b = pu(1:2, 3) isequal(a, b) This means: No, you cannot decide, what the inputs have be...

4 years ago | 0

Answered
Differentiate different matlab instances opened in GUI
You can use FEX: CmdWinTool . If you want to set the title of Matlab's command windows from inside the startup function, you ha...

4 years ago | 0

| accepted

Answered
how do i print this matrix?
Join the lines for k=10:10:160 to for k=10:10:160

4 years ago | 0

| accepted

Answered
Out of memory only on Mac
Working with "int" causes problems, when some compiler uses 32 bit integers and the other 64 bit integers. mxCreateNumericArray...

4 years ago | 0

Answered
Read csv in multiple directories in a loop
files = dir(fullfile(msFolder, '**', 'rawdata.csv')); % Search recursively n = numel(files); data = cell(1, n); frequenc...

4 years ago | 0

| accepted

Answered
Change resize algorithm in figure window
If you mean, how image() resizes the data to match the pixels of the display, see: https://www.mathworks.com/matlabcentral/answe...

4 years ago | 0

Answered
Why does not Matlab language support function/operator chaining?
Matlab does not support this, because it has not been implemented yet. Sorry. The answer is trivial. I'm using Matlab to solve...

4 years ago | 0

Answered
How to correct my code?
I did not understand, what you are asking for (see my comment). but this piece of the code looks suspicious: A=(H(x)/a(k))-...

4 years ago | 1

| accepted

Answered
why it will go wrong using 'cell'?
I confirm, that this is an inconsistent behavior. a = {[], []}; b = cell(1, 2); isequal(a, b) a{1}([]) = [] % Working: Not...

4 years ago | 0

| accepted

Answered
Defining a mathematical function as the summation of multiple functions
Why do you want to create the function symbolically? It is easy to define it directly: ht = @(u1, u2, u3, u4) sum((xdata(:, 1) ...

4 years ago | 0

Answered
Error when executing an existing code
Error: File: Untitled27.m Line: 1380 Column: 3 Unexpected MATLAB operator. (referent to: "function ret=arc2(r1,r2,h,phi)") At...

4 years ago | 0

Answered
How do I create an element wise if-else code, and apply equations to inputs that meet certain criteria?
"Elementwise" does either mean a loop: for k = 1:numel(sigma) Y = log10(28300 * sigma(k) / Eya); ... end Or you use...

4 years ago | 0

Answered
getting and printing data from matrix
Maybe your data are: X = [5 8 9 15 7 12; ... 1 3 2 3 1 2; ... 3 2 1 1 2 3]; If so, than...

4 years ago | 0

Answered
How to append a vector to a cell array?
C = {[1,4,1], 0:10}; % The cell v = linspace(1, 10, 100); % The vector C{end + 1} = v; % Or: C{numel(C) + 1} = v;...

4 years ago | 2

| accepted

Answered
fwrite and MATLAB for a raid0 disk - Only one lane?
What about trying it as C-Mex? data = randn(1024, 1024, 1024, 'double'); %8 GB tic uglyCWrite(data); toc // Short hack, U...

4 years ago | 0

Answered
How to bold in a sprintf function?
Ticks = linspace(0, 30, 7); ax = axes('XLim', [0, 30], 'XTick', Ticks, ... 'TickLabelInterpreter', 'latex'); for k = 1:...

4 years ago | 2

Load more