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

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

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

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

3 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

3 months ago | 0

| accepted

Answered

Polyfit is giving incorrect coefficients for correct plot fit.

If I run this script i get a good fit, see image N=10:10:60; t1 = [3.5 6.5 10 12.5 15.5 19]; t2 = [3 6.5 10 13 16 20]; t3 = ...

Polyfit is giving incorrect coefficients for correct plot fit.

If I run this script i get a good fit, see image N=10:10:60; t1 = [3.5 6.5 10 12.5 15.5 19]; t2 = [3 6.5 10 13 16 20]; t3 = ...

3 months ago | 0

| accepted

Answered

nccreate overwrite existing file

Have you tried this: if exist(filename) delete filename end nccreate.....

nccreate overwrite existing file

Have you tried this: if exist(filename) delete filename end nccreate.....

3 months ago | 0

| accepted

Answered

How Can i write a function that takes a structure array and returns this array with bubble sorting

Maybe this will work: ages=[structurearray.age]; [a,b]=sort(ages); newstructurearray=structurearray(b); The used structure i...

How Can i write a function that takes a structure array and returns this array with bubble sorting

Maybe this will work: ages=[structurearray.age]; [a,b]=sort(ages); newstructurearray=structurearray(b); The used structure i...

3 months ago | 0

Answered

year function does not read properly

year(input) tells you in which year the day of the input is, where the input is the day number, starting from first of january 1...

year function does not read properly

year(input) tells you in which year the day of the input is, where the input is the day number, starting from first of january 1...

3 months ago | 0

Answered

Extracting a value from a 3D table

Sure, In the first line "Num_nan=find(isnan(Table));" you get the positions of the NaN, but this is just a number. For example,...

Extracting a value from a 3D table

Sure, In the first line "Num_nan=find(isnan(Table));" you get the positions of the NaN, but this is just a number. For example,...

3 months ago | 0

Answered

How to solve differential movement equation?

I dont think you can solve this, a relation between x and y, or x and t, or a direction of the force is required.

How to solve differential movement equation?

I dont think you can solve this, a relation between x and y, or x and t, or a direction of the force is required.

3 months ago | 0

Answered

Extracting a value from a 3D table

Maybe this works, for output(a,b,c): Num_nan=find(isnan(Table)); c=floor(Num_nan/(81*81))+1; b=floor(rem(Num_nan,81*81)/81)+1...

Extracting a value from a 3D table

Maybe this works, for output(a,b,c): Num_nan=find(isnan(Table)); c=floor(Num_nan/(81*81))+1; b=floor(rem(Num_nan,81*81)/81)+1...

3 months ago | 0

| accepted

Answered

How to reuse the same format

Maybe this will work: a='%7.0f'; fprintf(strcat('defaults->',repmat(a,1,9),'\n'),header);

How to reuse the same format

Maybe this will work: a='%7.0f'; fprintf(strcat('defaults->',repmat(a,1,9),'\n'),header);

3 months ago | 0

Answered

Guys, i have no idea how to proceed with these two questions, would you please help me out, many thanks guys.

2.3: syms k vpasolve(det(R-k*i3)==13,k)

Guys, i have no idea how to proceed with these two questions, would you please help me out, many thanks guys.

2.3: syms k vpasolve(det(R-k*i3)==13,k)

3 months ago | 0

| accepted

Answered

Optimize evaluation of triple infinite series using FOR loops

Maybe you can compute p2vec{i,j} outside the k-for loop and multiply it inside the for loop with the k-factor.

Optimize evaluation of triple infinite series using FOR loops

Maybe you can compute p2vec{i,j} outside the k-for loop and multiply it inside the for loop with the k-factor.

3 months ago | 0

Answered

Callback function not forwarding the variables.

If you have the edges of the square you can maybe use this example to get the number of points inside the square. x=1:100; y=1...

Callback function not forwarding the variables.

If you have the edges of the square you can maybe use this example to get the number of points inside the square. x=1:100; y=1...

3 months ago | 0

Answered

How to limit the movement of a rectangle?

maybe this will work: roi = drawrectangle('Position',p ,'Color',[1 0 0]); t=0; while t<1 pause(0.15);pos=get(roi,'positi...

How to limit the movement of a rectangle?

maybe this will work: roi = drawrectangle('Position',p ,'Color',[1 0 0]); t=0; while t<1 pause(0.15);pos=get(roi,'positi...

3 months ago | 0

| accepted

Answered

How to limit the movement of a rectangle?

Maybe you can use the function: get(roi,'position') But i'm not sure what you want.

How to limit the movement of a rectangle?

Maybe you can use the function: get(roi,'position') But i'm not sure what you want.

3 months ago | 0

Answered

How to setup common file in .XML or .txt format to declare all variables globally for using it in simulink and stateflow?

Creating a txt file can be done with: a=10; b=20; c=30; d=40; FP=fopen(sprintf('textfile.txt'),'wt'); fprintf(FP,'variabl...

How to setup common file in .XML or .txt format to declare all variables globally for using it in simulink and stateflow?

Creating a txt file can be done with: a=10; b=20; c=30; d=40; FP=fopen(sprintf('textfile.txt'),'wt'); fprintf(FP,'variabl...

3 months ago | 0

Answered

How to save data stored in a cell for easy transfer to excel?

You can use the function writematrix: writematrix(Data,'filename.xlsx')

How to save data stored in a cell for easy transfer to excel?

You can use the function writematrix: writematrix(Data,'filename.xlsx')

3 months ago | 0

Answered

Replacing the last value after consecutive Nan

Try this: for i=2:numel(A) if isnan(A(i-1))&&A(i)>0 A(i)=0; end end

Replacing the last value after consecutive Nan

Try this: for i=2:numel(A) if isnan(A(i-1))&&A(i)>0 A(i)=0; end end

3 months ago | 0

| accepted

Answered

random matrix full rank

Hi, Try this one: T=6; a=rand(T); m=tril(a,-1); matrix=m+m'+eye(T).*rand(T);

random matrix full rank

Hi, Try this one: T=6; a=rand(T); m=tril(a,-1); matrix=m+m'+eye(T).*rand(T);

3 months ago | 1

| accepted

Answered

Index error during encryption

You can use this script: l = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','...

Index error during encryption

You can use this script: l = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','...

3 months ago | 0

Answered

Polyshape: stop Connecting first and last points.

Hi, do you mean this? load('Data'); a=polyshape(Data(:,1),Data(:,2)); b=regions(a); area=[b(2,1).Vertices(:,1) b(2,1).Verti...

Polyshape: stop Connecting first and last points.

Hi, do you mean this? load('Data'); a=polyshape(Data(:,1),Data(:,2)); b=regions(a); area=[b(2,1).Vertices(:,1) b(2,1).Verti...

3 months ago | 0

Answered

Separating Multiple Columns of Data Based on a Value in One Column

You can make a structure for each ROI like this: x=data; sep_x=struct; for ROI=[1,2,5,8]%?? a=find(x(:,1)==ROI); se...

Separating Multiple Columns of Data Based on a Value in One Column

You can make a structure for each ROI like this: x=data; sep_x=struct; for ROI=[1,2,5,8]%?? a=find(x(:,1)==ROI); se...

3 months ago | 0