Answered

function serialportlist is not working

I do not know if i have such a device. I want to play audio files via different USB speakers, do you have any tips how to do thi...

function serialportlist is not working

I do not know if i have such a device. I want to play audio files via different USB speakers, do you have any tips how to do thi...

19 hours ago | 0

Question

function serialportlist is not working

When I use the function 'serialportlist' to identify the serial ports on my laptop i get a 1x0 empty string array. ports=serial...

1 day ago | 1 answer | 0

Answered

How can I extract values from an N x 2 matrix?

What about this?: cord=zeros(1,2); for i=1:100 xx = input('Enter x coordinates in the form [0]'); yy = input('Enter ...

How can I extract values from an N x 2 matrix?

What about this?: cord=zeros(1,2); for i=1:100 xx = input('Enter x coordinates in the form [0]'); yy = input('Enter ...

5 days ago | 0

Answered

Custom colour bar, excluding the Blue from RGB.

Maybe you can try this: h=figure(); A = [200 200 200 200 200; 200 200 200 200 200; 200 200 100 200 200; 200 200 200 200 200; 2...

Custom colour bar, excluding the Blue from RGB.

Maybe you can try this: h=figure(); A = [200 200 200 200 200; 200 200 200 200 200; 200 200 100 200 200; 200 200 200 200 200; 2...

9 days ago | 0

Answered

Error: Inner Matrix Dimension Must Agree

you should use " .* " instead of " * " .

Error: Inner Matrix Dimension Must Agree

you should use " .* " instead of " * " .

9 days ago | 1

Answered

Index exceeds matrix dimensions error

You should use ( and ) not { and }. Try this code: t=zeros(10,1); for n=1:10 if n/2>2 t(n)=t(n-1)+1 end end

Index exceeds matrix dimensions error

You should use ( and ) not { and }. Try this code: t=zeros(10,1); for n=1:10 if n/2>2 t(n)=t(n-1)+1 end end

14 days ago | 0

| accepted

Answered

How can I get the column number of a matrix with smallest error to my value?

Mybe you can use: [x,y,z]=find(....)

How can I get the column number of a matrix with smallest error to my value?

Mybe you can use: [x,y,z]=find(....)

14 days ago | 0

Answered

Efficient way of selecting columns of a matrix

You can get the data from different columns also in two (maybe more?) ways: a=[1:10;11:20;21:30]; tic for i=1:10000 a(:,...

Efficient way of selecting columns of a matrix

You can get the data from different columns also in two (maybe more?) ways: a=[1:10;11:20;21:30]; tic for i=1:10000 a(:,...

17 days ago | 0

Answered

How can I convert all string cells in a table to numerical values?

If you use the import data tool, you can chose to ouput the data in matrix instead of a table. With this tool you can also gene...

How can I convert all string cells in a table to numerical values?

If you use the import data tool, you can chose to ouput the data in matrix instead of a table. With this tool you can also gene...

19 days ago | 1

| accepted

Answered

How can I use a loop to maximize correlation of multiple graphs?

Maybe something like this can help you: clear Y_data=[ones(1,40)*-6,-6:-2/20:-8,ones(1,140)*-8]; %just an example for x1=1:19...

How can I use a loop to maximize correlation of multiple graphs?

Maybe something like this can help you: clear Y_data=[ones(1,40)*-6,-6:-2/20:-8,ones(1,140)*-8]; %just an example for x1=1:19...

19 days ago | 0

| accepted

Answered

Why does cumtrapz return negative values?

Your X and Y are from high value to low values, resulting in negative areas. use fliplr() to mirror arrays X and Y. X=[0.5056 ...

Why does cumtrapz return negative values?

Your X and Y are from high value to low values, resulting in negative areas. use fliplr() to mirror arrays X and Y. X=[0.5056 ...

27 days ago | 1

Answered

Adding values from columns 1:i for each column for a new matrix of the same size

Something like this? matrix=[1 2 3; 1 2 3; 1 2 3; 1 2 3]; for i=1:size(matrix,2) matrix_new(:,i)=sum(matrix(:,1:i),2); e...

Adding values from columns 1:i for each column for a new matrix of the same size

Something like this? matrix=[1 2 3; 1 2 3; 1 2 3; 1 2 3]; for i=1:size(matrix,2) matrix_new(:,i)=sum(matrix(:,1:i),2); e...

27 days ago | 0

Answered

input image without writing a path directory in the code

maybe you can use this: https://nl.mathworks.com/matlabcentral/fileexchange/73801-adding-all-subfolders-of-a-certain-base-folde...

input image without writing a path directory in the code

maybe you can use this: https://nl.mathworks.com/matlabcentral/fileexchange/73801-adding-all-subfolders-of-a-certain-base-folde...

27 days ago | 0

Submitted

Adding all subfolders of a certain (base)folder to the path.

This code will add every subfolden within a certain base folder to the searchpath.

27 days ago | 4 downloads |

Answered

Draw horizontal lines using for loop on set of images

Maybe this works: Color=[255,255,0]; %color in 8bit, [255 255 0] is yellow width=3; %width of the line Line_Y_coor=[500 60...

Draw horizontal lines using for loop on set of images

Maybe this works: Color=[255,255,0]; %color in 8bit, [255 255 0] is yellow width=3; %width of the line Line_Y_coor=[500 60...

2 months ago | 1

| accepted

Answered

Mean of certain elements within a matrix

I think this will work: for i=1:371 Mean_i(i)=mean([matrix(i,5:6),matrix(i+1,2:4)]); end

Mean of certain elements within a matrix

I think this will work: for i=1:371 Mean_i(i)=mean([matrix(i,5:6),matrix(i+1,2:4)]); end

2 months ago | 0

| accepted

Answered

How do I plot error bar at only one location ?

just plot first without errorbar and than with errorbar for only the 4th value: plot(u,v,'b') hold on errorbar(u(4),v(4),err(...

How do I plot error bar at only one location ?

just plot first without errorbar and than with errorbar for only the 4th value: plot(u,v,'b') hold on errorbar(u(4),v(4),err(...

2 months ago | 0

| accepted

Answered

How to use loops to plot add graphs to a plot depending on checkbox selection

Which matlab version do you have? I have 2019a and it works. What do you see if you typ in the command window: fig.Children ...

How to use loops to plot add graphs to a plot depending on checkbox selection

Which matlab version do you have? I have 2019a and it works. What do you see if you typ in the command window: fig.Children ...

2 months ago | 0

Answered

How to draw multiple rectangular diffraction pattern

Somthing like this? clc clear all lambda=632e-9; k=(2*pi)/lambda; a=1e-3; b=4e-3; d=20e-3; Io = 100.0; R = 1; Y = (-0.4e-...

How to draw multiple rectangular diffraction pattern

Somthing like this? clc clear all lambda=632e-9; k=(2*pi)/lambda; a=1e-3; b=4e-3; d=20e-3; Io = 100.0; R = 1; Y = (-0.4e-...

2 months ago | 0

Answered

how to randomize a vector as fast as possible

this is finished in 28 sec, i dont know how fast other methods are. tic Vec=1:125000; numelVec=numel(Vec); new_Vec=zeros(1,n...

how to randomize a vector as fast as possible

this is finished in 28 sec, i dont know how fast other methods are. tic Vec=1:125000; numelVec=numel(Vec); new_Vec=zeros(1,n...

2 months ago | 0

Answered

How to use loops to plot add graphs to a plot depending on checkbox selection

I think you can use this script as an example: close all fig = figure; checkbox_USD = uicontrol(fig,'Style','Checkbox','Strin...

How to use loops to plot add graphs to a plot depending on checkbox selection

I think you can use this script as an example: close all fig = figure; checkbox_USD = uicontrol(fig,'Style','Checkbox','Strin...

2 months ago | 0

Answered

How to plot? Having a issue.. Need to plot evolution of the norm of a symbolic matrix for t=0 to 1.

Your PHI is a 4x4 matrix, do you want to plot 16 function against t? That can be done with: syms t PHI=[ 1, t, t/3 - (2*exp(...

How to plot? Having a issue.. Need to plot evolution of the norm of a symbolic matrix for t=0 to 1.

Your PHI is a 4x4 matrix, do you want to plot 16 function against t? That can be done with: syms t PHI=[ 1, t, t/3 - (2*exp(...

2 months ago | 0

Answered

How to use loops to plot add graphs to a plot depending on checkbox selection

You can get the value of the checkbox number i with v=fig.Children(i).Value So maybe you can make a for loop like this: figu...

How to use loops to plot add graphs to a plot depending on checkbox selection

You can get the value of the checkbox number i with v=fig.Children(i).Value So maybe you can make a for loop like this: figu...

2 months ago | 0

Answered

How to plot? Having a issue.. Need to plot evolution of the norm of a symbolic matrix for t=0 to 1.

you should use fplot or ezplot (https://nl.mathworks.com/help/symbolic/ezplot.html) to plot a 'sym' variable.

How to plot? Having a issue.. Need to plot evolution of the norm of a symbolic matrix for t=0 to 1.

you should use fplot or ezplot (https://nl.mathworks.com/help/symbolic/ezplot.html) to plot a 'sym' variable.

2 months ago | 0

Answered

How to plot Gantt Chart for job shop scheduling?

Do you mean something like this: Number_of_tasks=20; width=200/Number_of_tasks; startDates=1:20; endDates=3:22; for i=1:Num...

How to plot Gantt Chart for job shop scheduling?

Do you mean something like this: Number_of_tasks=20; width=200/Number_of_tasks; startDates=1:20; endDates=3:22; for i=1:Num...

2 months ago | 0

Answered

Plotting Terminal velocity Vs particle diameter

With this script you overwrite vt and dp every loop, so at the end you only have 1 single value for vt and dp and you cannot plo...

Plotting Terminal velocity Vs particle diameter

With this script you overwrite vt and dp every loop, so at the end you only have 1 single value for vt and dp and you cannot plo...

2 months ago | 0

| accepted

Answered

Loop is not running in Matlab

There are some errors in your script: i=0.0015:-0.0015:0.00001; Only gives the number 0.0015 as output, if you want that i goe...

Loop is not running in Matlab

There are some errors in your script: i=0.0015:-0.0015:0.00001; Only gives the number 0.0015 as output, if you want that i goe...

2 months ago | 0

| accepted

Answered

Random shuffle vector such that all elements fall in new index positions

Try this: v=[1:100]; %your vector List=1:numel(v); for i=1:numel(v) newList=List; newList(i)=[]; newpos=datasa...

Random shuffle vector such that all elements fall in new index positions

Try this: v=[1:100]; %your vector List=1:numel(v); for i=1:numel(v) newList=List; newList(i)=[]; newpos=datasa...

2 months ago | 0

Answered

Detecting Entire Column has the same integer value

Try this: if a(:,1)==a(1,1)&mod(a(1,1),1)==0 Ans=[1 0]; else Ans=[0 0]; end

Detecting Entire Column has the same integer value

Try this: if a(:,1)==a(1,1)&mod(a(1,1),1)==0 Ans=[1 0]; else Ans=[0 0]; end

2 months ago | 0

| accepted