已回答
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

5 years 前 | 0

| 已接受

已回答
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(...

5 years 前 | 0

| 已接受

已回答
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 ...

5 years 前 | 0

已回答
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-...

5 years 前 | 0

已回答
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...

5 years 前 | 0

已回答
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...

5 years 前 | 0

已回答
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(...

5 years 前 | 0

已回答
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...

5 years 前 | 0

已回答
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.

5 years 前 | 0

已回答
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...

5 years 前 | 0

已回答
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...

5 years 前 | 0

| 已接受

已回答
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...

5 years 前 | 0

| 已接受

已回答
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...

5 years 前 | 0

已回答
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

5 years 前 | 0

| 已接受

已回答
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 = ...

5 years 前 | 0

| 已接受

已回答
nccreate overwrite existing file
Have you tried this: if exist(filename) delete filename end nccreate.....

5 years 前 | 0

| 已接受

已回答
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...

5 years 前 | 0

已回答
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...

5 years 前 | 0

已回答
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,...

5 years 前 | 0

已回答
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.

5 years 前 | 0

已回答
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...

5 years 前 | 0

| 已接受

已回答
How to reuse the same format
Maybe this will work: a='%7.0f'; fprintf(strcat('defaults->',repmat(a,1,9),'\n'),header);

5 years 前 | 0

已回答
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)

5 years 前 | 0

| 已接受

已回答
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.

5 years 前 | 0

已回答
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...

5 years 前 | 0

已回答
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...

5 years 前 | 0

| 已接受

已回答
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.

5 years 前 | 0

已回答
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...

5 years 前 | 0

已回答
How to save data stored in a cell for easy transfer to excel?
You can use the function writematrix: writematrix(Data,'filename.xlsx')

5 years 前 | 0

已回答
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

5 years 前 | 0

| 已接受

加载更多