Answered

Find the average between each pair of points in a matrix

I'd do it as z=randi([-5 5],8) za=filter2(ones(2)/4,z) % averaging 2D filter with same size as input (zero padded) zv...

Find the average between each pair of points in a matrix

I'd do it as z=randi([-5 5],8) za=filter2(ones(2)/4,z) % averaging 2D filter with same size as input (zero padded) zv...

2 months ago | 1

Answered

Array rows differences and array filling in a loop

The cell array @Jon shows is simpler to code and what first strikes, but the answer to the Q? as you posed it to store into the ...

Array rows differences and array filling in a loop

The cell array @Jon shows is simpler to code and what first strikes, but the answer to the Q? as you posed it to store into the ...

2 months ago | 1

Answered

How do I edit this bar graph so that the weights appear equally distanced on the x-axis with 4 bars for each weight, all of different colour.

The weights vector is 'x' There are examples of grouped bar plots at the doc page...sorry, I said 'stacked' before; that's what...

How do I edit this bar graph so that the weights appear equally distanced on the x-axis with 4 bars for each weight, all of different colour.

The weights vector is 'x' There are examples of grouped bar plots at the doc page...sorry, I said 'stacked' before; that's what...

2 months ago | 0

Answered

Fit a equation to a scatter plot in log log scale with the given parameters

fn='https://www.mathworks.com/matlabcentral/answers/uploaded_files/1350879/Data_1.xlsx'; A=readmatrix(fn); x=A(:,1); y=A(:,2)...

Fit a equation to a scatter plot in log log scale with the given parameters

fn='https://www.mathworks.com/matlabcentral/answers/uploaded_files/1350879/Data_1.xlsx'; A=readmatrix(fn); x=A(:,1); y=A(:,2)...

2 months ago | 0

Answered

How do I edit this bar graph so that the weights appear equally distanced on the x-axis with 4 bars for each weight, all of different colour.

Use X as a vector as categorical (or if numeric, use 1:N and then write the x tick labels with the desired values for display), ...

How do I edit this bar graph so that the weights appear equally distanced on the x-axis with 4 bars for each weight, all of different colour.

Use X as a vector as categorical (or if numeric, use 1:N and then write the x tick labels with the desired values for display), ...

2 months ago | 0

Answered

How can I pass a large function into ODE45?

Write your function as an m file and pass a handle to it; don't try to do stuff in scripts or complicated stuff as anonymous fun...

How can I pass a large function into ODE45?

Write your function as an m file and pass a handle to it; don't try to do stuff in scripts or complicated stuff as anonymous fun...

2 months ago | 1

Answered

Extract matching row from another cell array

Air code; the load operation didn't work online... >> load all_files >> pieces=split(extractBefore(all_files,'.'),'_'); Error...

Extract matching row from another cell array

Air code; the load operation didn't work online... >> load all_files >> pieces=split(extractBefore(all_files,'.'),'_'); Error...

2 months ago | 0

| accepted

Answered

how to find the location of a specific element in a matrix or in a excel file

What do you mean "to find the location of each element"? You mean just read the file, don't you; the location is really of very...

how to find the location of a specific element in a matrix or in a excel file

What do you mean "to find the location of each element"? You mean just read the file, don't you; the location is really of very...

2 months ago | 0

| accepted

Answered

How I can find a specific word in a notepad text?

"i want to find the word " lege" in the document and then to count how mnay times apear this specific word" txt=readlines('your...

How I can find a specific word in a notepad text?

"i want to find the word " lege" in the document and then to count how mnay times apear this specific word" txt=readlines('your...

2 months ago | 2

| accepted

Answered

Matlab App Designer - Output to TextArea Error - 'Value' must be a character vector, or a 1-D array of the following type: cell array of character vectors, string, or categori

app.ClassificationTextArea.Value{i+1} = classification; tries to address the .Value property as a cell array which it doesn't s...

Matlab App Designer - Output to TextArea Error - 'Value' must be a character vector, or a 1-D array of the following type: cell array of character vectors, string, or categori

app.ClassificationTextArea.Value{i+1} = classification; tries to address the .Value property as a cell array which it doesn't s...

2 months ago | 0

Answered

Editor Text Is Too Small

The Editor Font selection is buried under the "Fonts -- Custom" menu in the Preferences. Why it's not associated with the Edito...

Editor Text Is Too Small

The Editor Font selection is buried under the "Fonts -- Custom" menu in the Preferences. Why it's not associated with the Edito...

2 months ago | 0

| accepted

Answered

Formatting read data from text files

txt=readlines('YourInputFile.txt'); % read text file as string array fprintf('%s\n',txt) % dumpt to com...

Formatting read data from text files

txt=readlines('YourInputFile.txt'); % read text file as string array fprintf('%s\n',txt) % dumpt to com...

2 months ago | 1

Answered

How to exctract specific elements from .txt file?

d= [' 4; 65; 7.5; MGK ; 4; 5; 66; MARKUS; 46.63641; 65' '11; 26; 5 ; LEON ; 78; 93; 88; LUTHER; 50.3554 ...

How to exctract specific elements from .txt file?

d= [' 4; 65; 7.5; MGK ; 4; 5; 66; MARKUS; 46.63641; 65' '11; 26; 5 ; LEON ; 78; 93; 88; LUTHER; 50.3554 ...

2 months ago | 0

Answered

I plotted 2 plots each with error bars, but the legend is not showing the symbols correctly, how to solve it?

a = [1:5 ]; b = [6:10]; x = [1:5 ]; mu1 = mean(a); cig1 = std(a); err1 = cig1; mu2 = mean(b); cig2 = std(b); err2 = cig...

I plotted 2 plots each with error bars, but the legend is not showing the symbols correctly, how to solve it?

a = [1:5 ]; b = [6:10]; x = [1:5 ]; mu1 = mean(a); cig1 = std(a); err1 = cig1; mu2 = mean(b); cig2 = std(b); err2 = cig...

2 months ago | 0

| accepted

Answered

number of significant digits for the coefficients in curve fitter (polynomial, with two degree)

All are estimated to full double-precision; the number of digits that are displayed is solely dependent upon how you look at the...

number of significant digits for the coefficients in curve fitter (polynomial, with two degree)

All are estimated to full double-precision; the number of digits that are displayed is solely dependent upon how you look at the...

2 months ago | 1

Answered

how to print datetime in fprintf

We don't have sufficient data to reproduce the problem -- we don't have definitions of ProfName, ProfDateNum, nor indNaN Guess...

how to print datetime in fprintf

We don't have sufficient data to reproduce the problem -- we don't have definitions of ProfName, ProfDateNum, nor indNaN Guess...

2 months ago | 1

| accepted

Answered

try...catch for memory full error in imaq toolbox ?

Well, you probably can manage to do it from the above, but it's peculiar as Bruno notes...observe if we take your monitoring dat...

try...catch for memory full error in imaq toolbox ?

Well, you probably can manage to do it from the above, but it's peculiar as Bruno notes...observe if we take your monitoring dat...

2 months ago | 0

Answered

How to convert matrix or vector in Matlab workspace into C/C++ array usable in ".c" file?

a=1:5; vname='a'; precision=16; fmt=['uint%d_t %s={' repmat('%d,',1,numel(a)-1) '%d}']; c_code=sprintf(fmt,precision,vname,a...

How to convert matrix or vector in Matlab workspace into C/C++ array usable in ".c" file?

a=1:5; vname='a'; precision=16; fmt=['uint%d_t %s={' repmat('%d,',1,numel(a)-1) '%d}']; c_code=sprintf(fmt,precision,vname,a...

2 months ago | 0

Answered

Why is there such a big difference between the fitting results of 'exp2' and the same form of custom function?

The biggest difference is probably found in the documentation under the 'Nonlinear Least-Squares Options" parameter 'StartPoint'...

Why is there such a big difference between the fitting results of 'exp2' and the same form of custom function?

The biggest difference is probably found in the documentation under the 'Nonlinear Least-Squares Options" parameter 'StartPoint'...

2 months ago | 1

| accepted

Answered

csv file wrong numbers filled with MATLAB

"(attached a screenshot of the function definition)..." Don't use images for code; attach the text and format the code. Nobody...

csv file wrong numbers filled with MATLAB

"(attached a screenshot of the function definition)..." Don't use images for code; attach the text and format the code. Nobody...

2 months ago | 0

| accepted

Answered

How to change the Xtick direction of ONLY one of the two (top or bottom) X-axis lines ?

% my plot figure plot(1:9) % properties hAx1 = gca; hAx1.XAxis.TickDirection='out'; hold on hAx2=axes('Position',hAx1.P...

How to change the Xtick direction of ONLY one of the two (top or bottom) X-axis lines ?

% my plot figure plot(1:9) % properties hAx1 = gca; hAx1.XAxis.TickDirection='out'; hold on hAx2=axes('Position',hAx1.P...

3 months ago | 1

| accepted

Answered

For Loop Starting at Zero

H = 0.1; I = 200; Y = 0; BI = zeros(I,1); b = pi; for i = 1:I b = fzero(@(b)(b*tan(b)-H),b); BI(i,1) =...

For Loop Starting at Zero

H = 0.1; I = 200; Y = 0; BI = zeros(I,1); b = pi; for i = 1:I b = fzero(@(b)(b*tan(b)-H),b); BI(i,1) =...

3 months ago | 0

Answered

Make changes to multiple files simultaneously?

Notepad++ has a feature that may work if you can make the replacement with a [regexp] expression as a substitution. Alternative...

Make changes to multiple files simultaneously?

Notepad++ has a feature that may work if you can make the replacement with a [regexp] expression as a substitution. Alternative...

3 months ago | 0

Answered

Reading a file and loading variables using function

A = 10; B = 30; C =15; A_Threshold = 70; B_Threshold = 80; C_Threshold = 85; save sample.mat A B C A_Threshold B_Threshold...

Reading a file and loading variables using function

A = 10; B = 30; C =15; A_Threshold = 70; B_Threshold = 80; C_Threshold = 85; save sample.mat A B C A_Threshold B_Threshold...

3 months ago | 0

Answered

Scatter Plotting With Custom Markers?

There's no way I'm aware of to use an image as a marker in a line or scatter object, There's a <FEX submission> that will let y...

Scatter Plotting With Custom Markers?

There's no way I'm aware of to use an image as a marker in a line or scatter object, There's a <FEX submission> that will let y...

3 months ago | 0

Answered

Addition of two plots (Coordinates)

You have to add the starting location of your subsection to the returned location if you subset the overall signal, The loop yo...

Addition of two plots (Coordinates)

You have to add the starting location of your subsection to the returned location if you subset the overall signal, The loop yo...

3 months ago | 0

Answered

FOR loop count to the end but the length of the array is different

Observe the following... y(7,1)=10 Note that MATLAB created the array of seven values and filled the last entry. In your orig...

FOR loop count to the end but the length of the array is different

Observe the following... y(7,1)=10 Note that MATLAB created the array of seven values and filled the last entry. In your orig...

3 months ago | 0

Answered

How to put non repeated elements of a symmetric matrix in a row vector?

"... the matrices are symmetric with names of z1,z2,...z571;" First, do NOT create sequentially-named variables such as that; f...

How to put non repeated elements of a symmetric matrix in a row vector?

"... the matrices are symmetric with names of z1,z2,...z571;" First, do NOT create sequentially-named variables such as that; f...

3 months ago | 1

Answered

What is the purpose of zero function?

function CoherentState=CoherentStatefunc(alpha,DIM) CoherentState=zeros(DIM,1); for n=0:(DIM-1) Coh...

What is the purpose of zero function?

function CoherentState=CoherentStatefunc(alpha,DIM) CoherentState=zeros(DIM,1); for n=0:(DIM-1) Coh...

3 months ago | 1

Answered

How to write function for two variables

I'd approach writing the functional something more like-- function y=Y(C,x1,x2) % Magic function Y=fn(C, x1, x2) from unknow...

How to write function for two variables

I'd approach writing the functional something more like-- function y=Y(C,x1,x2) % Magic function Y=fn(C, x1, x2) from unknow...

3 months ago | 0

| accepted