https://fr.mathworks.com/matlabcentral/answers/questions MATLAB Answers — New Questions 2019-08-23T19:56:38Z tag:fr.mathworks.com,2005:Question/477091 2019-08-21T20:12:47Z 2019-08-23T19:56:38Z Can I write a script that keeps rows that are within 5% and 10 cells above and below a specific cell? The idea is to have a script that takes stable data eleminating the peaks and valleys. I want to have that cell compared with the 10 before and after itself and if all this 21 values are within 5% then I can keep that data. That script should also be able to check all the rows of an excel spreadsheet. Any suggestions and ideas are much appreciated! I am a newby trying to do advanced stuff :) Diego Dranuta https://fr.mathworks.com/matlabcentral/profile/authors/15981205-diego-dranuta tag:fr.mathworks.com,2005:Question/477326 2019-08-23T12:59:32Z 2019-08-23T19:52:18Z counting total no of particles in a bin in histogram Hi, i have a basic problem. I had made a histogram with nbins=100. I want to count the number of particles of that bin which has maximum number of particles and display it. what should be the best way to do it. Thank you very much. Any help is highly appreciated. Sumera Yamin https://fr.mathworks.com/matlabcentral/profile/authors/5464714-sumera-yamin tag:fr.mathworks.com,2005:Question/477365 2019-08-23T19:24:26Z 2019-08-23T19:50:50Z semilog minor ticks are incorrect. How can I produce a plot with correctly ticked log axes? x=[1:.1:40]; y=[2:.01:5.9]; semilogy(x,y) These three lines give an unusable plot with linear minor ticks and log major ticks. The data is plotted correctly but the minor ticks and grid are wrong. Marc Ross https://fr.mathworks.com/matlabcentral/profile/authors/16461-marc-ross tag:fr.mathworks.com,2005:Question/477352 2019-08-23T17:21:32Z 2019-08-23T19:50:45Z Editing impoly polygons in a GUIDE app In a GUIDE app, I want to draw polygons on an image (say 4 polygons), then copy the polygons and display on a different image, then edit those polygons and save the changes with the new image. AFAIK, I need to use impoly because I have R2017b. I click a button on the GUI, which runs a function where I use h = impoly. I am experimenting with addNewPositionCallback inside this function, but after this function has executed, I don't see any way to get to that polygon again to detect changes. When I display a particular image, I want to draw the polygons associated with that image (not a problem), but the problem comes when I want to detect edits that the user can then make to the polygons associated with that image. Any examples of doing this would be appreciated. Again, I don't have a problem storing polygons and drawing them later, the problem is editing them and saving the changes. Thanks Ron RonE https://fr.mathworks.com/matlabcentral/profile/authors/12847390-rone tag:fr.mathworks.com,2005:Question/476749 2019-08-19T20:23:18Z 2019-08-23T19:50:14Z nonlinear fit of experimental data Dear MatLab Experts, I would like to generate a nonlinear regression model to fit my experimental data 'Mk_Superf_FSF' as function of the independent variables 'MaxFDiam' and 'MinFDiam' which are respectively the max and min diameter of an arbirarily shaped closed and connected 2D surface. I also added the variable 'Area' which is obviously correlated to max and min diameters so I think it is not wise to use that as well. I was suggested a linear fit for the experimental data (see attached picture). The 7th order polynomial p(x) fits the data very well but the suggested formula is non physical. In fact, the variable used is a sum of quantities with different units: x = MaxFDiam * MinFDiam + Area / MaxFDiam + Area / MinFDiam + MaxFDiam / MinFDiam I cannot assign a units to ithe resulting sum because the product of the two diameters has units [mm^2.] whereas the Area/MaxDIameter has units [mm], the ratio of the two diamters is unitless. I tried to fit a sum of two negative exponentials where in the exponent I have the Area ad the product of the diameters respectively. MatLab complained printing out that the Jacobian has a column of all zeros. I tried some other combinations of exponential functions. Again MatLab complained stating that the model returns "NaN" of "Infinity". Some other times MatLab printed out that that maximum number of iterations had been exceeded. I tried a power-law fit as follows: coeffs0 = [0.8672 1 1] opts = statset('fitnlm'); opts.RobustWgtFcn = 'bisquare'; X = [MaxFDiam' MinFDiam']; mdlfun = @(coeff, X) coeff(1)* X(:,1).*X(:,2).^coeff(2) + coeff(3); mdl = fitnlm(X,Mk_Superf_FSF',mdlfun, coeffs0,'Options', opts, 'CoefficientNames', {'a' , 'b', 'c'}); This time MatLab did not complain but the resulting model is anything but good. The R^2 value is awful. The P_values are very high except for one. mdl = Nonlinear regression model: y ~ a*x1*x2^b + c Estimated Coefficients: Estimate SE tStat pValue ________ ________ ________ __________ a 0.007407 0.02121 0.34922 0.73352 b -0.26657 0.87603 -0.30429 0.76658 c 0.93603 0.048648 19.241 8.0919e-10 Number of observations: 14, Error degrees of freedom: 11 Root Mean Squared Error: 0.0363 R-Squared: 0.215, Adjusted R-Squared 0.0721 F-statistic vs. constant model: 1.51, p-value = 0.264 Maybe the model is not right. Maybe the initial parameter values are not good..... I would greatly appreciate some help at getting a decent fit. Above all, I would like to learn techniques to: (1) devise the model formula (2) choose the initial parameter values Thank you so much for any suggestion and help. Best regards, Maura E. M. Maura Monville https://fr.mathworks.com/matlabcentral/profile/authors/13231254-maura-monville tag:fr.mathworks.com,2005:Question/477363 2019-08-23T19:14:49Z 2019-08-23T19:48:44Z Time reading in matlab Hi, I have a data set, using matlab I need to read all the data.But the date and time reading is not working.Please help me. Silpa K https://fr.mathworks.com/matlabcentral/profile/authors/15760628-silpa-k tag:fr.mathworks.com,2005:Question/477231 2019-08-22T18:13:25Z 2019-08-23T19:47:27Z catalog data convert into csv Hi, I have a dataset in.catalog format. I need to convert it into .csv or .xlsx format for reading it in matlab.Is there is any tool freely available for this? Please help me.Thank you. Silpa K https://fr.mathworks.com/matlabcentral/profile/authors/15760628-silpa-k tag:fr.mathworks.com,2005:Question/457161 2019-04-18T12:17:02Z 2019-08-23T19:36:44Z How to related PCA output to the original data? Hello, I'm new to PCA and I would like to learn the outcome of pca function. I have read the document and checked others works but I'm a bit confused on how to related the results (wcoeff, latent, explained) to the original data. For example, I'm using the example from the document as below. I understand the (wcoeff) presents the eigenvector vectors. the (latent) presents the eigenvalues. the (explained) is the percentage of the total variance explained by each principal component. NOW, how are all these information are related to the main data which is the ingredients here? how do I know from looking at the results in (explained) that the 55 % is related to which variables or columns in the ingredients matrix? load hald [wcoeff,~,latent,~,exp lained] = pca(ingredients,'VariableWeights','variance') wcoeff = 4×4 -2.7998 2.9940 -3.9736 1.4180 -8.7743 -6.4411 4.8927 9.9863 2.5240 -3.8749 -4.0845 1.7196 9.1714 7.5529 3.2710 11.3273 latent = 4×1 2.2357 1.5761 0.1866 0.0016 explained = 4×1 55.8926 39.4017 4.6652 0.0406 Yaser Khojah https://fr.mathworks.com/matlabcentral/profile/authors/8998848-yaser-khojah tag:fr.mathworks.com,2005:Question/477307 2019-08-23T10:10:38Z 2019-08-23T19:32:10Z Determine the subsets of data that are the most correlated with y-data I have a pair of X-Y data containing 20 datapoints. Each datapoints correspond to a group, there are 8 groups, so, let say, X1 - X3 (together with Y1 - Y3) belongs to Group 1, and so on. The number of datapoints in each group is not necessarily the same. I found that for datapoints from, let say, Group 3 are very correlated between its X's and its Y's; but it's not good enough because I want to show that if I combine datapoints from multiple groups (let say Group 1, 3 and 7), I still can have high correlation. I dont think it's efficient to do this manually since I have to test 2^8=256 combinations. Is there any MATLAB function that do this automatically, or is there any math method to solve this automatically? Thank you. Muhammad Khairul Adib Muhammad Yusof https://fr.mathworks.com/matlabcentral/profile/authors/10143472-muhammad-khairul-adib-muhammad-yusof tag:fr.mathworks.com,2005:Question/477255 2019-08-22T22:33:06Z 2019-08-23T19:29:21Z Getting "Error writting 'Filename.m', Access is denied" I have my file save in my desktop, and MATLAB itself is downloaded in program files. This error comes up when I try to edit and save the file. Any idea what might be causing this? Cyrus WaChong https://fr.mathworks.com/matlabcentral/profile/authors/9457538-cyrus-wachong tag:fr.mathworks.com,2005:Question/477256 2019-08-22T22:56:43Z 2019-08-23T19:26:04Z how take input and save to an array in matlab gui Hi, I am new to matlab gui. Actually I want take input and then store them as an array using matlab gui. Can anybody guide me how to do that. Actually what I want is whenever I press push button what ever values in edit boxes they should save in an array. length of the array is decided by user in code. Muhammad Haziq https://fr.mathworks.com/matlabcentral/profile/authors/11787906-muhammad-haziq tag:fr.mathworks.com,2005:Question/477358 2019-08-23T18:38:14Z 2019-08-23T19:26:02Z Only getting the last iteration from for loop? I've seen similar questions posted, but I can't figure out where my code is going wrong. Any insight would be hugely appreciated. The code is as follows: ar0 = zeros(100,n); int = zeros(100,n); for r = 1:n int = fd0.*sin(r.*Phi); fint = fit (Phi,int,'smoothingspline','SmoothingParam',0.999999999,'Normalize','on'); ar0 = (2/pi).*(integrate(fint,Phi,0)); rar2 = ((ar0.^2).*r); end Dq0= (1/l.^2)*(pi/4).*sum(rar2) Essentially this is just a Fourier sine series, so the higher n is (defined at the start), the more accurately the iterations should converge on a solution. int should be the line I want to integrate, where fd0 and Phi both have 100 values, but this line should change with each 'r' value. Each line should then be fit and integrated according to the ar0 equation, so I should end up with as many ar0 values as n values. rar2 is computing r times each ar0 value squared. The final Dq0 is a function of the sum of all these rar2 values, but I'm only getting the Dq0 using the last iteration's value. Is there a clear error in my code here? Thanks very much in advance. Ed Frost https://fr.mathworks.com/matlabcentral/profile/authors/15962359-ed-frost tag:fr.mathworks.com,2005:Question/477366 2019-08-23T19:25:54Z 2019-08-23T19:25:54Z Fit a plane to 3D data from image Hello, I have an image, I, where >> whos I Name Size Bytes Class Attributes I 2056x2464 5065984 uint8 I plotted the surface using surf: surf(double(I)) which displays this: Now I would like to fit this surface to a plane. So I think I need to use something like fit([x, y], z, 'ax+by+c') but I can't figure out how to format the x,y,z input data using my image. Does anyone know how to do this? Thanks, Jonathan Avesar https://fr.mathworks.com/matlabcentral/profile/authors/15577646-jonathan-avesar tag:fr.mathworks.com,2005:Question/477364 2019-08-23T19:22:48Z 2019-08-23T19:22:48Z How do I see the boundaries of the buckets created when initializing a KDTreeSearcher object? I would like to use MATLAB to construct a kd-tree with bucket size 1 to help partition the unit hypercube. The following MATLAB help page https://www.mathworks.com/help/stats/classification-using-nearest-neighbors.html#bsfsm9c has some helpful diagrams illustrating exactly what I want. Is there any way to access the coordinates of the bounding regions constructed by the kd-tree as visualized in the linked example page? As far as I can tell there are no methods associated with KDTreeSearcher which allow me to do this and I cannot find a link to code associated with the linked example. Leland Farmer https://fr.mathworks.com/matlabcentral/profile/authors/10684865-leland-farmer tag:fr.mathworks.com,2005:Question/477359 2019-08-23T18:39:19Z 2019-08-23T19:20:50Z GUI table first column width adjustment Hi everyone, I'm trying to adjust the first column width of my table in Matlab GUI. I know how to adjust the width marked in red with set(handles.PulseProperties,'ColumnWidth',{10,20,30,40}); function or using Table Property Editor. But I'm curious if there is a way to adjust the width marked in black, basically the row name region. Currently it's automatically fitted by Matlab according to the length of the string. But as you can see it's so wide that takes a lot of space. Any ideas? wYw https://fr.mathworks.com/matlabcentral/profile/authors/6245393-wyw tag:fr.mathworks.com,2005:Question/477312 2019-08-23T11:10:21Z 2019-08-23T19:15:47Z How to find the position of points given relative distances ? Hi, I have found the relative distances between 4 microphones using cross-correlation. The values are not very accurate because of measurement noise or other noise in the recordings. Given the distances, is it possible to find the approximate positions of the microphones using the first one as the reference (position [0 0]) ? The likely positions are on circles whose radius are the given distances. The relative distances follow. The distance estimates may be wrong, so I am more interested in knowing if the problem can be solved in general, that is if the measurements were correct. Some sort of grid search maybe ? For simplification I have assumed that the microphones are on the same level, that is a 2D problem. from mic. 1 to mic. 2: -4.915(m) from mic. 1 to mic. 3: 2.571(m) from mic. 1 to mic. 4: -5.123(m) from mic. 2 to mic. 3: 5.162(m) from mic. 2 to mic. 4: -0.212(m) from mic. 3 to mic. 4: -5(m) % this one is very uncertain Thanks in advance. Kamran https://fr.mathworks.com/matlabcentral/profile/authors/4421250-kamran tag:fr.mathworks.com,2005:Question/477351 2019-08-23T16:58:41Z 2019-08-23T19:08:38Z Why is this giving me an error message when trying to use trapz. Hello, I'm trying to integrate for each time step the following. But it keeps giving me an error message. B=18.6; t0=0; step=0.5; tmax=90; npas=tmax/step+1; U=60; for i= 1:npas t0=t0+step; s = (U.*t0)./B; fun3 = @(s) (0.0081*(exp(-0.0058.*s))-0.0392.*exp(-0.0833.*s)); y3 = fun3(s); q3(i) = trapz(s,y3); end B=18.6; t0=0; step=0.5; tmax=90; npas=tmax/step+1; U=60; for i= 1:npas t0=t0+step; s = (U.*t0)./B; fun3 = @(s) (0.0081*(exp(-0.0058.*s))-0.0392.*exp(-0.0833.*s)); y3 = fun3(s); q3(i) = trapz(s,y3); end Saruultugs Batzorig https://fr.mathworks.com/matlabcentral/profile/authors/14132098-saruultugs-batzorig tag:fr.mathworks.com,2005:Question/477361 2019-08-23T18:51:51Z 2019-08-23T19:03:10Z How to skip some strings in a text file Hey guys, I want to skip the lines until I reach the two numeric data columns beneath the "lag time(s)" and "g2-1" (it would be the 18th line) and plot them as x,y respectively. So basically I want to tell it to ignore first 18 lines while reading file, and after that, in each line put the number in each column in either x or y. Your help will be appreciated, thanks. Mohammad Hossein Khalili Samani https://fr.mathworks.com/matlabcentral/profile/authors/13336910-mohammad-hossein-khalili-samani tag:fr.mathworks.com,2005:Question/477362 2019-08-23T18:52:17Z 2019-08-23T19:01:50Z XMAX must be a floating point scalar in double integral. Kindly help. CODE: x=0 y=0 u0=4*pi*(10^-7); f=5*10^6; w=2*pi*f; u=4*pi*(10^-7); U=2; a=0.5 N=5 for d=0.1:0.1:1 s=0.001 N=5 wd=0.011 r0=0.0001608 e=7*(8.854*10^-12) %dry sand check again sig=0.11 %variable so check again alpha=3.9*10^-3 %temp coeff T=26 %soil temp T0=33 %room temp dout=2*a d1=sqrt(2)*a aw=wd./2 din=dout-(2*N*wd)-(2*(N-2)*s) davg=(dout-din)./(dout+din) ltc=4.*N.*(dout-(N-1).*(wd+s)) %ORIGINAL CORRECT Aw=pi.*(aw.^2) R=(r0.*ltc.*(1+alpha.*(T-T0)))./Aw theta=90 J=2.*sin(theta).*sin(theta)+cos(theta).*cos(theta) sd=(w.*(sqrt((u.*e./2).*(sqrt(1+(sig./(w.*e))^2)-1))))^(-1) G=exp(-d./sd) Mt1=0 Bz=@(ai) (((u)/(2*pi*sqrt(((r0+ai)^2)+(d^2))))*((ellipticK(pi/2))+(((-r0^2-d^2+ai^2)/((r0-ai)^2+d^2))*ellipticE(pi/2)))) M=zeros(1,N*N) for i=1:1:N ai=a-2*(N-1)*wd-2*(N-1)*s:2*(wd+s):a-2*(N-N)*wd-2*(N-N)*s for j=1:1:N aj=a-2*(N-1)*wd-2*(N-1)*s:2*(wd+s):a-2*(N-N)*wd-2*(N-N)*s M=integral2(Bz,0,ai,0,aj) end end Mt1=Mt1+M Mtotal=Mtl*J*G end end ERROR: Error using integral2 (line 76) XMAX must be a floating point scalar. Error in FPSCCLM2 (line 93) M=integral2(Bz,0,ai,0,aj) Swathi S https://fr.mathworks.com/matlabcentral/profile/authors/10719580-swathi-s tag:fr.mathworks.com,2005:Question/477357 2019-08-23T18:34:40Z 2019-08-23T19:00:56Z Can an object pass a handle to itself? Can an object of a handle class pass its own handle to a function, so that the function has access to certain properties of the object? I believe this would be similar to use of the 'this' pointer in C++. Here's what I'm trying to do, in case there's a better way to accomplish it: I have class A, instances of which will create child objects that are instances of another class B. Objects of class B will only ever exist as children of class A objects, and their behavior will depend on the current values of some their parent's properties. Thus I'd like them to have the handle to their parent as one of their properties. Thus, I'd like the parent to be able either to set the child's property directly or to pass a handle to the class B constructor. The only easy (but tedious) alternative I see is to have the parent explicitly pass the current values of any required properties to the methods of the child when it calls them. Suggestions? Thanks. Bruce Elliott https://fr.mathworks.com/matlabcentral/profile/authors/1178580-bruce-elliott tag:fr.mathworks.com,2005:Question/108424 2013-12-03T13:06:02Z 2019-08-23T18:56:14Z fix the mistake line 91 function % This program simulates a single-channel fiber transmission link % using the symmetrized split-step Fourier algorithm. % % written by Jong-Hyung Lee clear all %============================================= % Define Time Window and Frequency Window %============================================= taum = 2000; dtau = 2*taum/2^11; tunit= 1e-12; % make time unit in psec tau = (-taum:dtau:(taum-dtau))*tunit; fs = 1/(dtau*tunit); tl = length(tau)/2; w = 2*pi*fs*(-tl:(tl-1))/length(tau); % w=angular freq. wst = w(2)-w(1); %============================================= % Define Physical Parameters %============================================= c = 3e5; %[km/sec] speed of light ram0 = 1.55e-9; %[km] center wavelength k0 = 2*pi/ram0; n2 = 6e-13 ; %[1/mW] gamm = k0*n2 ; %[1/(km*mW)] alphaDB = 0.2 ; % [dB/km] Power Loss alpha = alphaDB/(10*log10(exp(1))); %[1/km] Power Loss in linear scale % Dispersion parameters (beta3 term ignored) Dp = -2; % [ps/nm.km] beta2 = -(ram0)^2*Dp/(2*pi*c); % [sec^2/km] %============================================= % Define Input Signal %============================================= % A single Gaussian pulse is assumed. Po = 2; % [mW] initial peak power of signal source C = 0; % Chirping Parameter m = 1; % Super Gaussian parameter (m=1 ==> Gaussian) t0 = 50e-12; %[sec] initial pulse width at = sqrt(Po)*exp(-0.5*(1+1i*C)*(tau./t0).^(2*m)); % Input field in the time domain a0 = fft(at(1,:)); af = fftshift(a0); % Input field in the frequency domain %============================================= % Define Simulation Distance and Step Size %============================================= zfinal = 100; %[km] propagation distance pha_max = 0.01; %[rad] maximum allowable phase shift due to the nonlinear operator % pha_max = h*gamma*Po (h = simulation step length) h = fix(pha_max/(gamm*Po)); % [km] simulation step length M = zfinal/h; % Partition Number % Define Dispersion Exp. operator % Dh = exp((h/2)*D^), D^=-(1/2)*i*sgnb2*P, P=>(-i*w)^2 Dh = exp((h/2)*(-alpha/2+(1i/2)*beta2*w.^2)); % %================================================% % Propagation Through Fiber % %================================================% % Call the subroutine, sym_ssf.m for the symmetrized split-step Fourier method [bt,bf] = sym_ssf(M,h,gamm,Dh,af); % Preamplifier at the receiver % Optical amplifier is assumed ideal (flat frequency response and no noise) GdB = 20; % [dB] optical amplifier power gain gainA = sqrt(10^(GdB/10)); % field gain in linear scale rt = gainA*bt; % plot the received power signal figure(1) plot(tau,abs(rt).^2,'r') function [to,fo] =symssf(M,h,gamma,Dh,uf0) % Symmetrized Split-Step Fourier Algorithm % % ==Inputs== % M = Simulation step number ( M*h = simulation distance ) % h = Simulation step % gamma = Nonlinearity coefficient % Dh = Dispersion operator in frequency domain % uf0 = Input field in the frequency domain % % ==Outputs== % to = Output field in the time domain % fo = Output field in the frequency domain % % written by Jong-Hyung Lee for k = 1:M %============================================================= % Propagation in the first half dispersion region, z to z+h/2 %============================================================= Hf = Dh.*uf0; %========================================================== % Initial estimate of the nonlinear phase shift at z+(h/2) %========================================================== % Initial estimate value ht = ifft(Hf); % time signal after h/2 dispersion region pq = ht.*conj(ht); % intensity in time u2e = ht.*exp(h*1i*gamma*pq); %Time signal %============================================================= % Propagation in the second Dispersion Region, z+(h/2) to z+h %============================================================= u2ef = fft(u2e); u3ef = u2ef.*Dh; u3e = ifft(u3ef); u3ei = u3e.*conj(u3e); %======================================================== % Iteration for the nonlinear phase shift(two iterations) %======================================================== u2 = ht.*exp((h/2)*1i*gamma*(pq+u3ei)); u2f = fft(u2) ; u3f = u2f.* Dh; u4 = ifft(u3f); u4i = u4.*conj(u4); u5 = ht.*exp((h/2)*1i*gamma*(pq+u4i)); u5f = fft(u5); uf0 = u5f.*Dh; u6 = ifft(uf0); u6i = u6.*conj(u6); %============================================================= % Maximum allowable tolerance after the two iterations etol = 1e-5; if abs(max(abs(u6i))-max(abs(u4i)))/max(abs(u6i)) > etol disp('Peak value is not converging! Reduce Step Size'), break end %============================================================= end to = u6; fo = uf0; abed https://fr.mathworks.com/matlabcentral/profile/authors/3558502-abed tag:fr.mathworks.com,2005:Question/398879 2018-05-03T16:12:36Z 2019-08-23T18:56:03Z Is it possible to use the Selenium library, webdriver.Chrome in MATLAB? I have a code in python and am passing the application to MATLAB. Only the code is using the webdriver library to grab the information from the site. # Open site browser = webdriver.Chrome () browser.get ('http://icgem.gfz-potsdam.de/ICGEM/Service.html')          # Model Directory model_dir = Select (browser.find_element_by_id ('model_directory')) model_dir.select_by_visible_text (dire) How can I solve it? Lucas Lima https://fr.mathworks.com/matlabcentral/profile/authors/4429541-lucas-lima tag:fr.mathworks.com,2005:Question/476604 2019-08-18T17:43:36Z 2019-08-23T18:47:43Z Creating an interface with Guide How to insert in Matlab code for example the data of a vector in function of time to create an immage with the icon "axes"? for example a vector h = [67, 32, 67, 87, 45, 89]; time : t = 1:6; when I use Guide, then Blank GUI, then Axes, I have this general code: function varargout = untitled1(varargin) % UNTITLED1 MATLAB code for untitled1.fig % UNTITLED1, by itself, creates a new UNTITLED1 or raises the existing % singleton*. % % H = UNTITLED1 returns the handle to a new UNTITLED1 or the handle to % the existing singleton*. % % UNTITLED1('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in UNTITLED1.M with the given input arguments. % % UNTITLED1('Property','Value',...) creates a new UNTITLED1 or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before untitled1_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to untitled1_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help untitled1 % Last Modified by GUIDE v2.5 18-Aug-2019 19:28:36 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @untitled1_OpeningFcn, ... 'gui_OutputFcn', @untitled1_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT % --- Executes just before untitled1 is made visible. function untitled1_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to untitled1 (see VARARGIN) % Choose default command line output for untitled1 handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes untitled1 wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = untitled1_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (seguie GUIDATA) % Get default command line output from handles structure varargout{1} = handles.output; How to insert my new data to create that interface?? Enrica Brunetti https://fr.mathworks.com/matlabcentral/profile/authors/9333820-enrica-brunetti tag:fr.mathworks.com,2005:Question/477245 2019-08-22T20:46:37Z 2019-08-23T18:45:27Z In a large matrix, find and provide location of rows containing zeros I have a series of large matrix, 7184x72001, in which the first column is a datenum vector, and all the rows represent values for each datenum. If a row didn't meet certain criteria, I asked my forloop to fill it with zeros. Unfortunately I didn't consider how large my matrix was and how hard it would then be to find the rows that contain zeros, if they exist. I know that in my first example, there is one row that is all zeros, excluding the datenum vector in the first column. Is it possible to make a variable which contains the datenum value for the rows which contain zeros? The following code, I have used to confirm that the row of zeros exist, but it doesn't tell me WHERE it is. Ideally I would get a list of datenums for the rows which are filled with zeros. for row = 1 : size(Agoat, 1) zeroLocations{row} = find(Agoat(row, :) == 0) end Thank you everyone! Louise Wilson https://fr.mathworks.com/matlabcentral/profile/authors/15959472-louise-wilson tag:fr.mathworks.com,2005:Question/477355 2019-08-23T18:14:56Z 2019-08-23T18:42:51Z using solve for solving self and mutual inductance of a pmsm I am trying to calculate inducatce values (which should have second order harmonic of voltage or current harmonic) in permanent magnet motor. But this isnot working. Please check.following is the code. ------------------------------------------------ clear all syms Ls Lm t w; R = 0.0021; psiPM = 0.0014; uA = 10 * cos((w*t)+(10*pi/180)); uB = 10 * cos((w*t)-(2*pi/3)+(10*pi/180)); uC = 10 * cos((w*t)+(2*pi/3)+(10*pi/180)); iA = 2 * cos(w*t); iB = 2 * cos((w*t)-(2*pi/3)); iC = 2 * cos((w*t)+(2*pi/3)); bemfA = psiPM * w *cos(w*t); bemfB = psiPM * w * cos((w*t)-(2*pi/3)); bemfC = psiPM * w * cos((w*t)+(2*pi/3)); EqnA = uA - (R*iA + Ls * diff(iA,t) + Lm * diff(iB,t) + Lm * diff(iC,t) + bemfA); EqnB = uB - (R*iB + Ls * diff(iB,t) + Lm * diff(iA,t) + Lm * diff(iC,t) + bemfB); EqnC = uC - (R*iC + Ls * diff(iC,t) + Lm * diff(iA,t) + Lm * diff(iB,t) + bemfC); Eqns = [EqnA == 0,EqnB == 0,EqnC == 0, Ls > 0, Lm > 0,t > 0,w > 0]; S = solve(Eqns,[w,Lm,Ls,],'ReturnConditions',true) S.Lm S.conditions Kushal Basutkar https://fr.mathworks.com/matlabcentral/profile/authors/4430714-kushal-basutkar tag:fr.mathworks.com,2005:Question/477360 2019-08-23T18:40:42Z 2019-08-23T18:40:42Z How do I calculate the accuracy of Artificial neural networks (ANN) and Support Vector Machine (SVM) ? A set of data contains both heart disease people and well people is given in the link below. From that, how can I find the accuracy of Artificial Neural Network (ANN) and Support Vector Machine (SVM) in MATLAB? link: https://drive.google.com/file/d/1u-DoDkXKW6OZk90IKVaWmWzIjEezBxBF/view?usp=sharing Mehedi Hasan Bappy https://fr.mathworks.com/matlabcentral/profile/authors/15968778-mehedi-hasan-bappy tag:fr.mathworks.com,2005:Question/477345 2019-08-23T16:41:42Z 2019-08-23T18:38:53Z Multiple ROI within one slice median calculation Hi all, I have a mask file 192x192x10, within each slice there are multiple ROIs with mask = 1 and background = 0. I then use bsxfun to apply this mask to an image 192x192x17 with values between [0,1]. What I'm trying to calculate is the median value of each individual ROIs within each slice. Is there an easy way to calculate the median value of each individual ROIs? Many thanks! Fiona Fiona Gong https://fr.mathworks.com/matlabcentral/profile/authors/13844156-fiona-gong tag:fr.mathworks.com,2005:Question/472234 2019-07-17T20:50:52Z 2019-08-23T18:34:23Z How can I extract the frame around the windows? Hello, I need to extract the frame on the wall around the window. How can I do that? I have tried with edge detection and binarization, but I have got always a different result. There are images, where even the edges are not recognizable. But, there are images full with different edges where I can not eliminate the redundant components. I hope someone can help me. Thank you. L https://fr.mathworks.com/matlabcentral/profile/authors/3290037-l tag:fr.mathworks.com,2005:Question/477356 2019-08-23T18:32:28Z 2019-08-23T18:32:28Z How to choose correct camera model for single camera calibration? When using the camera calibrator app, I want to know which distortion parameters (skew, tangential distortion, third radial coefficient..) I need to consider for my particular camera. Seeing that calibration results vary (unacceptably so, for my application) when tangential distortion, skew, or a third coefficient for radial distortion are considered, I need to be sure about which distortions are actually inherent in my camera to get an accurate calibration. Radial distortion is obvious, without analysis, but how many coefficients should I use? Is there a way to know if my camera has tangential distortion? The calibrator app documentation offers some pointers on how to improve the accuracy of calibration, such as ensuring that mean reprojection errors are below a certain threshold, but none of these tips offer an analytical method for choosing certain parameters over others. I would like to think that accounting for all possible distortions yields the most trustoworthy calibration result, but I need to know for certain as the application is a metrological one where a couple pixels represents the tolerance range on a manufactured part. Wyatt Boyd https://fr.mathworks.com/matlabcentral/profile/authors/15887129-wyatt-boyd tag:fr.mathworks.com,2005:Question/477330 2019-08-23T13:35:25Z 2019-08-23T18:31:03Z How can be generated aperiodic triangle carrier signal for PWM I would like to generate triangle signal starts from 0 degree and stops at 60 degree and then starts at 120 degree and stops at 180 degree for half cycle sine wave reference, and then it is repeat itself. If possible by coding or simulink. The attached picture would explain the required triangle wave. ali al-khayyat https://fr.mathworks.com/matlabcentral/profile/authors/4439916-ali-al-khayyat tag:fr.mathworks.com,2005:Question/477348 2019-08-23T16:46:25Z 2019-08-23T18:23:47Z Solving Inequalities greater than and smaller than at the same time Hi All, I have been trying to solve the following inequalities I mean I'd like to divide the both sides by 10 then get (the left side and right side): -15<10*S<15 I did the following Matlab Code: clear all; close all; clc; syms S real; negative=solve(-15<10*S,S); positive=solve(10*S<15,S); numb(:,1)=[negative positive] Is that possible to get the two possible results from one single line of comand ?, I mean could it possible to write the following equation as it's in Matlab -15<10S<15 Ali Tawfik https://fr.mathworks.com/matlabcentral/profile/authors/13520758-ali-tawfik tag:fr.mathworks.com,2005:Question/476590 2019-08-18T14:49:22Z 2019-08-23T18:00:25Z ERROR came as "Index exceeds matrix dimensions". %% When I incorporate 3 eqns, ERROR came as "Index exceeds matrix dimensions". %%Here I have initial condition f=[0 0 0 ], BC: gl=[coswt t t], gr =[0 0 0 ]. What next? Here is my trial: H=10;R=5;Pr=1;G1=5;G2=5;Kc=1;Sc=0.22;wt=pi/2;Q=H-(R/Pr); xl=0; xr=5; % x domain [xl,xr] J = 10; % J: number of division for x dx = (xr-xl)/ J; % dx: mesh size tf = 01; % final simulation time Nt = 100; % Nt: number of time steps dt = tf/Nt; mu = dt/(dx)^2; % Evaluate the initial conditions x = xl : dx : xr; % generate the grid point % f(1:J+1) since array index starts from 1 f1 = 0;f2 = 0;f3 = 0; %%%I.C % store the solution at all grid points for all time steps u = zeros(J+1,Nt); v = zeros(J+1,Nt); w = zeros(J+1,Nt); U=[u; v; w]; % Find the approximate solution at each time step for n = 1:Nt t = n*dt; % current time % boundary condition at left side gl = [cos(wt); t; t]; % boundary condition at right side gr = [0; 0; 0]; if n==1 % first time step for j=2:J % interior nodes u(j,n) = (1+dt*Q)*f1(j) + dt*(G1*f2(j)+G2*f3(j))+mu*(f1(j+1)-2*f1(j)+f1(j-1)); v(j,n) = (1+dt*Q)*f2(j) + (mu/Pr)*(f2(j+1)-2*f2(j)+f2(j-1)); w(j,n) = (1-dt*Kc)*f3(j) + (mu/Sc)*(f3(j+1)-2*f3(j)+f3(j-1)); U=[u(j,n) v(j,n) w(j,n)]; end U(1,n) = gl; % the left-end point U(J+1,n) = gr; % the right-end point else for j=2:J % interior nodes u(j,n)= (1+dt*Q)*u(j,n-1)+ dt*(G1*v(j,n-1)+G2*w(j,n-1))+ mu*(u(j+1,n-1)-2*u(j,n-1)+u(j-1,n-1)); v(j,n)= (1+dt*Q)*v(j,n-1)+ (mu/Pr)*(v(j+1,n-1)-2*v(j,n-1)+v(j-1,n-1)); w(j,n)= (1+dt*Q)*w(j,n-1)+ (mu/Sc)*(w(j+1,n-1)-2*w(j,n-1)+w(j-1,n-1)); U=[u(j,n) v(j,n) w(j,n)]; end U(1,n) = gl; % the left-end point U(J+1,n) = gr; % the right-end point end end % Plot the results tt = dt : dt : Nt*dt; figure(1) plot(x,u) hold on MINATI PATRA https://fr.mathworks.com/matlabcentral/profile/authors/12692023-minati-patra tag:fr.mathworks.com,2005:Question/477350 2019-08-23T16:51:45Z 2019-08-23T17:46:12Z Assume and find different possible unknown variables of inequalities , Need help please Hi All, I have inequalities, with two unkonwn variables, So How could I assume one variables with different numbers, and get the others? I mean: -15<10*x+2*y<20 How could I assume for example x=2, 3, and so on, and then find answer of (y) depends on the value of (x) I have been trying to apply assume, and find commands, but unfortunaley, I could not So I hope anyone could help me Please Looking to hearing from you Thank you, Ali Tawfik https://fr.mathworks.com/matlabcentral/profile/authors/13520758-ali-tawfik tag:fr.mathworks.com,2005:Question/477260 2019-08-22T23:49:02Z 2019-08-23T17:42:05Z . Find a MATLAB built in function that is used to find the lowest common denominator of fractions. Hello, I new to Matlab and I need help with this one problem. "Find a MATLAB built in function that is used to find the lowest common denominator of fractions. Then use that function to show that the lowest common denominator of (hint, your input and solution will only contain one denominator values.' David Durost https://fr.mathworks.com/matlabcentral/profile/authors/15989242-david-durost tag:fr.mathworks.com,2005:Question/477242 2019-08-22T20:16:53Z 2019-08-23T17:41:09Z How to read in a file automatically through loop? Hello everyone! I need your help in finding a way to read in a a file each iteration. My Folder looks like that: and I want that each time it reads the file in order. For example, for j=1--> reads in the first file for j=2--> reads in the second file .....and so on. Until now, I used to read in the files every time manually,but I would like if my script could do it on its own to save time. I appreciate any help :) Ifigenia Aslanidou https://fr.mathworks.com/matlabcentral/profile/authors/14560030-ifigenia-aslanidou tag:fr.mathworks.com,2005:Question/477122 2019-08-22T04:10:56Z 2019-08-23T17:31:10Z How to crop specific portion of a grayscale image? I have few OCT images which I want to crop. I have converted those images into grayscale images. Below are the resulting images. The part under the red box(brighter portion of the image) needs to be cropped. I tried using imcrop(). I want to create a GUI where the images could be cropped automatically by pressing a button. Using imcrop() won't allow me to automate the process as then I have to manually crop the images. I tried using the code below: img = imread('gray4.jpg'); % % get red, green, blue channels redC = img(:,:,1); greenC = img(:,:,2); blueC = img(:,:,3); % % % mask where red channel is greater than blue channel and green channel greater than blue channel mask = blueC > 120; % % overlay mask into original image finalimg = bsxfun(@times, img, cast(mask,class(img))); % %plotting figure imshow(finalimg) The result is displayed in result.jpg. Please note that result.jpg corresponds to Picture4.jpg. It could be noticed that some information under the red box in Picture4.jpg is lost which is not desirable. I think it is probably related to mask = blueC > 120 in the code above. I was wondering if it is possbile to automate the process so that any image could be cropped as desired everytime a new file is opened. Any suggestions would be appreciated. Thank you. Warid Islam https://fr.mathworks.com/matlabcentral/profile/authors/9112730-warid-islam tag:fr.mathworks.com,2005:Question/477029 2019-08-21T12:43:30Z 2019-08-23T17:30:40Z Resample multiple overlapping datetime to 1-minute (and 15-minutes) resolution? Coming back again on resampling datetime.... Situation is I have many water pumps which are filled up in different time-frames. I have this table with multiple overlapping time and the total volume of individual pumps. Each row is basically a different water pump. Column 1 (Start time), Column 2 (End time), Column 3 (Volume) I want to sample the data to minute resolution (also 15 mins resolution) with the specified volume. Example: Pump1: 00:04:34 06:33:34 56 Pump2: 00:10:09 09:50:01 93 What I want it 00:04:00 56 00:05:00 56 .... 00:10:00 56+93 00:11:00 56+93 .... 06:34:00 93 As you can see, it sums up when there is overlapping time. Or else it is the only volume. I have attached the actual table as well. Thanks! Alex https://fr.mathworks.com/matlabcentral/profile/authors/5450592-alex tag:fr.mathworks.com,2005:Question/5993 2011-04-21T17:02:11Z 2019-08-23T17:28:05Z Capture from Multiple Webcams Hi everyone, I am trying to use the Image Acquisition Toolbox to capture images from six webcams at the same time. The problem I am having is that only five actually work in MATLAB, even though all six will preview at the same time in other webcam programs. Is there a way to get MATLAB to use MJPEG instead of YUY2? The cameras do support MJPEG, which uses considerably less bandwidth, but it does not show up in matlab. I am on windows 7 x64, with 12 gb of RAM. The CPU usage is below 30% with all cameras previewing. Are there any limitation I don't know about that would cause only 5 to work at a time? Maybe matlab is limiting memory or cpu usage, even though I have plenty? Any suggestions? Thanks Greg https://fr.mathworks.com/matlabcentral/profile/authors/2677197-greg tag:fr.mathworks.com,2005:Question/71828 2013-04-12T21:21:50Z 2019-08-23T17:27:47Z add editor to te command window in matlab hi, then I run a script, the editor opens in a separate file, but I would prefer to see the editor with the script above the command window, how can I do that? Locks https://fr.mathworks.com/matlabcentral/profile/authors/3695210-locks tag:fr.mathworks.com,2005:Question/477353 2019-08-23T17:25:06Z 2019-08-23T17:25:06Z Can't launch matlab via Jacob Hi, Our software lauches Matlab and excutes commands via the JACOB Java COM interface. Normally when we call the invoke() method via a JACOB ActiveXComponent with "Execute" and the path to matab file to execute, Matlab launches and executes just fine. Now, we just setup a new Windows 10 system and when we make the call, Matlab isn't launched and we don't see the plots we should. If I launch Matlab independantly (not via COM) and attempt to display the plots with the same command we pass to "Execute" we get the plots. Is there some registration part that might have been missed on the Matlab install to register the Matlab Java COM interface? I don't seem to get any exceptions thrown or errors when I try to launch Matlab from Java, it just never launches. Thanks, -Mike Michael Garcia https://fr.mathworks.com/matlabcentral/profile/authors/5741266-michael-garcia tag:fr.mathworks.com,2005:Question/475364 2019-08-08T08:46:23Z 2019-08-23T17:17:32Z How to generate Polyspace project options into a text file from an already existing Polyspace project in Polyspace Code Prover 2016b? Can anyone please specify the syntax, how and where to use the command to do the above specified function. Imran Ahmed https://fr.mathworks.com/matlabcentral/profile/authors/9699489-imran-ahmed tag:fr.mathworks.com,2005:Question/475597 2019-08-09T17:02:27Z 2019-08-23T17:16:08Z When writing in an already existing table - JDBC driver error relation already exists Hi, I'm trying to insert information obtained and modified from a .csv file to a database through matlab in order to run some tests on the public data. To this objective I created a Postgresql database and the required table, since from this I got the idea I could pass the table from the matlab workspace onto the database table directly. I setup de JDBC connection, tested and all is okay. However when I run the sqlwrite command, though it can create new table with the information I give, if table already exists but is empty, it simply gives the error: Error using database.jdbc.connection/sqlwrite (line 104) JDBC JDBC/ODBC Error: JDBC Driver Error: ERROR: relation "ozonezurich.testschema.ozonetable" already exists. The code, filename = 'test.csv'; Table = Read_csv(filename); datasource = "zurichtest"; username = "postgres"; password = "************"; conn = database(datasource,username,password); ColumnNames = {'ObsDate','TimeStamp','Latitude','Longitude','HDOP', ... 'DeviceID','O3ppB','Temperature','Humidity'}; Table.Properties.VariableNames = ColumnNames; sqlwrite(conn,'"ozonezurich.testschema.ozonetable"',Table(1:100,:)) close(conn); Does anyone know how can I fix this? P.S: Having the .csv file I know I can run the tests, however, further ahead on the project I'll need to do this or something similar. Since I'll be processing data and will be needing to write it on a database. Luís Marques https://fr.mathworks.com/matlabcentral/profile/authors/6291449-luis-marques tag:fr.mathworks.com,2005:Question/388465 2018-03-15T10:31:53Z 2019-08-23T17:15:10Z I want to save multiple images in a folder? I made the code but the looping variable comes in the string function so a single image is saved in the folder. Is any other way of separating the looping variable from the colon bars. img=imread('cameraman.tif'); for i=1:5 img=imread('http://satellite.imd.gov.in/img/3Dnesec_ir1.jpg') imwrite(img,'D:\output database\i.jpg','jpg')% x be a image to write end Shashank Srivastava https://fr.mathworks.com/matlabcentral/profile/authors/8877891-shashank-srivastava tag:fr.mathworks.com,2005:Question/477336 2019-08-23T14:40:10Z 2019-08-23T17:13:37Z How can I get date and time from Nist server? I want to get the actual date and time from Nist.gov servers in MatLab using tcp connection to their server "time.nist.gov". I've already tried another method using url https://nist.time.gov/actualtime.cgi?lzbc=siqm9b but it doesn't work anymore as it says "Use of this script is explicitly forbidden". I coded this, but the return variable is a "uint8" 1x51 array and I cannot get what I need: clc; Nist_Time = tcpclient('time.nist.gov',13); pause(0.5); tcpdata = read(Nist_Time); disp(tcpdata) I expect to get a string with the 'tcpclient' formula where I can convert it into "YYYY-MM-DD HH:MM:SS" format Andrea Nebiolo https://fr.mathworks.com/matlabcentral/profile/authors/11946437-andrea-nebiolo tag:fr.mathworks.com,2005:Question/377858 2018-01-18T23:52:27Z 2019-08-23T17:12:04Z Merge isocap and isosurf to get one surface Dear Colleagues, I having an issue with merging surfaces. I have a function f defined below for which I want to generate a volume enclosed by the isosurface and the isocap. I wish to merge these two surfaces into one surface that I want to extract later as stl file using stlwrite. is there a way to do so ? f = @(x,y,z) cos(2.*pi.*y).*sin(2.*pi.*x)+cos(2.*pi.*z); O = 0:.05:1; [x,y,z] = meshgrid(O); v = f(x,y,z); p1 = isosurface(x,y,z,v,0.2); p2 = isocaps(x,y,z,v,0.2); oraib alketan https://fr.mathworks.com/matlabcentral/profile/authors/8043139-oraib-alketan tag:fr.mathworks.com,2005:Question/477317 2019-08-23T11:29:16Z 2019-08-23T17:10:40Z How can I change a FOTRAN code into a MATLAB code To convert, followings are some steps i applied : 1. Download and extract f2matlab into your computer 2. In matlab, go to the folder in which you extract f2matlab 3. In matlab command, put >> f2matlab('myfortran.f'); During conversion I have following errors >> f2matlab('mmm.f'); %the filte mmm.f in desktop ----------------------------------------------------------- | f2matlab -- Ben Barrowes, Barrowes Consulting | ----------------------------------------------------------- Error using fscanf Invalid file identifier. Use fopen to generate a valid file identifier. Error in f2matlab (line 212) fid=fopen(filename); filestr=fscanf(fid,'%c'); fclose(fid); I searched internet but did not find answer how to solve my problem. Can anyone tell me how to solve this error Message in MATLAB . Johan Johan https://fr.mathworks.com/matlabcentral/profile/authors/12590840-johan-johan tag:fr.mathworks.com,2005:Question/477337 2019-08-23T14:58:54Z 2019-08-23T17:06:23Z Drawing lines from 2 or more separate points to one target point and calculating the distance between them Hello, I have a plot where I create random points scattered around a set of central points. I am trying to draw lines from the 2 central points to another target point,. There will be more central points than 2 in the future so an adaptable solution is preferred. After drawing the lines, I need to calculate the distance between each point and the target point, find the minimum distance value and keep the line associated with the minimum distance value and delete the longer one. Below Ive included a picture of the basic situation. I line A is longer than line B then I will keep line B and vice versa. I need to be able to do this for every point on the graph and hopefully simultaneously. I also included the test code I am using to draw lines between one central point and one target but I havent been able to tweak it properly for multiple points. for i = 1:LengthB x2(i) = B(i,1); y2(i) = B(i,2); Line_matrix1(i,:) = line([x0, x2(i)],[y0, y2(i)], 'linewidth', 1.5, 'color', 'r'); drawnow; hold on end Vance Blake https://fr.mathworks.com/matlabcentral/profile/authors/15947118-vance-blake tag:fr.mathworks.com,2005:Question/98050 2012-09-10T15:55:00Z 2019-08-23T17:03:09Z Why do I get an error saying "Undefined function or variable 'matlabrc'" when executing a program that uses a MATLAB-compiled shared library? I am trying to use a MATLAB-compiled shared library in a C++ program. There are no issues when I use the same code with the libraries compiled using MATLAB Compiler 4.7 (R2007b). However, when I recompile all the MATLAB libraries using MATLAB Compiler 4.9 (R2008b) and then try to execute the same program, the <libName>Initialize() function fails with the following error: ERROR: ??? Undefined function or variable 'matlabrc' MathWorks Support Team https://fr.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-team tag:fr.mathworks.com,2005:Question/477143 2019-08-22T07:12:16Z 2019-08-23T17:01:19Z Hello matlab I want join two different forms. I want to connect my login form with my project. Please help me Sir...? Hello matlab I want join two different forms. I want to connect my login form with my project. Please help me Sir...? I am working on my final year project so I am doing Ficial recognition attendance system so I want to join two different forms. Thank you Fawad Chandio https://fr.mathworks.com/matlabcentral/profile/authors/15676386-fawad-chandio tag:fr.mathworks.com,2005:Question/477244 2019-08-22T20:18:19Z 2019-08-23T16:59:06Z MOD for optimization variable Hi, I have to optimize matrix to obtain quantities that will be divisible by certain numbers. When I use MOD on numbers, it works fine, for example MOD(10,3)=1. However, when I try to create constraint that I want my optimization variable x to be divisible by let's say 3 MOD(x,3), I get an error Undefined function 'mod' for input arguments of type 'optim.problemdef.OptimizationVariable'. Is there anything I can do to solve this issue? Thanks in advance. annazy https://fr.mathworks.com/matlabcentral/profile/authors/15952358-annazy