tag:ww2.mathworks.cn,2005:/matlabcentral/fileexchange/feed?q=type%3AFunctionMATLAB Central File Exchangeicon.pnglogo.pngMATLAB Central - File Exchange - type:FunctionUser-contributed code library2020-08-15T14:18:28-04:0013051160714082020-04-30T20:17:28Z2020-04-30T20:17:28Zdfield8Interactive app to study a given first order ODE<p>This is a nice interactive tool to study first order ODEs, which was originally created by John Polking at Rice University (together with other tools such as pplane and odesolve).The original versions (see also here <a href="https://math.rice.edu/~polking/odesoft/solver.html">https://math.rice.edu/~polking/odesoft/solver.html</a> for more information) only work up to MATLAB versions R2014a. A great version of pplane8 which works in any MATLAB version can be found here: <a href="https://www.mathworks.com/matlabcentral/fileexchange/61636-pplaneNote">https://www.mathworks.com/matlabcentral/fileexchange/61636-pplaneNote</a> that at the time of writing there are a couple of versions on file exchange (both called dfield9) from Gerardo Garcia (<a href="https://www.mathworks.com/matlabcentral/fileexchange/64437">https://www.mathworks.com/matlabcentral/fileexchange/64437</a>) and Iourii Kouznetsov (<a href="https://www.mathworks.com/matlabcentral/fileexchange/65886">https://www.mathworks.com/matlabcentral/fileexchange/65886</a>), however the former gives warnings for versions 2015a and later, and errors out for versions 2017b and later. The latter works without errors or warnings, but the text is disproportionally larger and out of place. Both versions have the toolbar on in the setup window and tend to place the display window a little out of reach in the upper right part of the screen sometimes.This version of dfield8 is the closest to the original in look and feel, but it is faster, and it works for any version from R2014b on.</p>Giampiero Campahttps://www.mathworks.com/matlabcentral/profile/1692307-giampiero-campa700322020-08-09T08:58:59Z2020-08-09T08:58:59ZRobust Empirical Mode Decomposition (REMD)A useful adaptive signal processing tool for multi-component signal separation, non-stationary signal processing.<p>The REMD is an improved empirical mode decomposition powered by soft sifting stopping criterion (SSSC). The SSSC is an adaptive sifting stop criterion to stop the sifting process automatically for the EMD. It extracts a set of mono-component signals (called intrinsic mode functions) from a mixed signal. It can be used together with Hilbert transform (or other demodulation techniques) for time-frequency analysis.</p>Liu Zhilianghttps://www.mathworks.com/matlabcentral/profile/12638821-liu-zhiliang744372020-03-09T23:00:47Z2020-03-09T23:00:47ZboxplotGroupGroup boxplots together along the x-axis with space between groups.<p>x = {rand(100,2), rand(20, 2), rand(150,2)}; boxplotGroup(x)The lines above will create two groups of three boxplot boxes per group, with space separating the groups. You can specify the amount of space between groups, the primary labels under each box, and the secondary labels that identify the groups. Group labels can be horizontal, under the x-axis, or vertical, between groups. Other boxplot properties can be passed to Matlab's boxplot function as well. NOTE: If you're working with a grouping variable 'g', use the syntax boxplot(x,g) along with the "Group Appearance" options described in Matlab's boxplot() documentation.<a href="https://www.mathworks.com/help/stats/boxplot.html#d118e146984Also">https://www.mathworks.com/help/stats/boxplot.html#d118e146984Also</a> see Kelly Kearney's boxplot2()<a href="https://www.mathworks.com/matlabcentral/fileexchange/59303-boxplot2">https://www.mathworks.com/matlabcentral/fileexchange/59303-boxplot2</a></p>Adam Danzhttps://www.mathworks.com/matlabcentral/profile/3753776-adam-danz732252019-11-04T09:32:49Z2019-11-04T09:32:49Zmatlab GUI with arduino matlab GUI with arduino <p>matlab GUI with arduino e. saleh saeid bohligae.mail <a href="mailto:zwuitina@yahoo.com">zwuitina@yahoo.com</a></p>saleh said bouhligahttps://www.mathworks.com/matlabcentral/profile/6136849-saleh-said-bouhliga731032020-06-08T06:55:02Z2020-06-08T06:55:02ZcopyUIAxesCopies UIAxes (eg. AppDesigner) and most properties to a new figure and recreates the legend and colorbar if they exist.<p>Use copyUIAxes() to copy plots in AppDesigner or any UIAxes onto regular axes which can be easily saved, printed, or modified. copyUIAxes copies all children and most properties of a UIAxes to regular axes. If the UIAxes has a legend or colorbar, they can be recreated in the new axes, too. copyUIAxes(ax) creates a new figure and copies the UIAxes (ax) content to the new figure. copyUIAxes(ax, destination) copies the UIAxes to the destination which can be a figure or axis handle. copyUIAxes(ax, 'copyPosition', true) will copy the position properties so the copied axes have the same position relative to the figure as the UIAxes or App.See the file's help section for other optional inputs and several demos. --------------------------------Notes--------------------------------Matlab's copyobj() is not supported with UIAxes (eg. AppDesigner). In r2020a Matlab released exportgraphics() and copygraphics() which do support uiaxes and uifigures and makes parts of copyUIAxes() obsolete.For discussion on this topic: <a href="https://www.mathworks.com/matlabcentral/answers/281318-how-can-i-save-a-figure-within-app-designer">https://www.mathworks.com/matlabcentral/answers/281318-how-can-i-save-a-figure-within-app-designer</a></p>Adam Danzhttps://www.mathworks.com/matlabcentral/profile/3753776-adam-danz732582019-11-05T20:16:28Z2019-11-05T20:16:28ZMatlab FractalsQuick and dirty MatLab function for Julia and Mandelbrot Sets<p>Plotter for Mandelbrot and Julia sets. Zooming enabled up to doubles precision.Available as standalone app, matlab app, or a function. The function is the most stable and has more freedom but the apps work quite well for people who just want to play with fractals.</p>Avehttps://www.mathworks.com/matlabcentral/profile/16150894-ave194602020-01-24T10:40:06Z2020-01-24T10:40:06ZZfitZFIT is a function which can PLOT, SIMULATE and FIT impedance data<p>% Zfit(data)Plots the impedance DATA which has to be a 3-columns wise matrix [FREQ, RealZEXP, ImagZEXP]. Impedance, admittance, capacitance and modulus representations in the complex plane are then pushbutton obtainable.%The others usages are described in the help lines with examples too...</p>Jean-Luc Dellishttps://www.mathworks.com/matlabcentral/profile/869820-jean-luc-dellis740102020-05-14T14:06:00Z2020-05-14T14:06:00ZgetContourLineCoordinatesGet a table of contour line coordinates from a contour object.<p>Use the outputs from any of the contour plot functions to produce a table of (x,y) coordinates of the contour lines organized by contour level and group. [cm, h] = contour(___);contourTable = getContourLineCoordinates(cm);--or-- contourTable = getContourLineCoordinates(h);contourTable = Level.........Group..........X............Y ____________________________________ -5.8504.........1..........0.44266....-1.75 -5.8504.........1..........0.375........-1.8038 -5.8504.........1..........0.25..........-1.8526 -5.8504.........1..........0.125........-1.8498 etc....Where Level is the contour level in the LevelList of a contour object, Group is a grouping variable for contour levels, and (X,Y) are coordinates along the contour lines. </p>Adam Danzhttps://www.mathworks.com/matlabcentral/profile/3753776-adam-danz728142020-04-16T14:40:30Z2020-04-16T14:40:30ZMultivariate Variational Mode Decomposition (MVMD)The function MVMD applies the Multivariate Variational Mode Decomposition (MVMD) algorithm to multivariate or multichannel data.<p>The function MVMD applies the Multivariate Variational Mode Decomposition (MVMD) algorithm [1] to multivariate or multichannel data sets. The method is an alternative to another popular algorithm named Multivariate Empirical Mode Decomposition (MEMD). We have verified this code through simulations involving synthetic and real world data sets containing 2-16 channels. However, there is no reason that it shouldn't work for data with more than 16 channels.% Input and Parameters:% ---------------------signal - input multivariate signal that needs to be decomposedalpha - the parameter that defines the bandwidth of extracted modes (low value of alpha yields higher bandwidth)tau - time-step of the dual ascent ( pick 0 for noise-slack )K - the number of modes to be recoveredDC - true if the first mode is put and kept at DC (0-freq)init - 0 = all omegas start at 0 1 = all omegas start uniformly distributed 2 = all omegas initialized randomlytol - tolerance value for convergence of ADMM% Output:% --------------------- u - the collection of decomposed modes u_hat - spectra of the modes omega - estimated mode center-frequencies[1] N. Rehman, H. Aftab, Multivariate Variational Mode Decomposition, arXiv:1907.04509, 2019. </p>Naveed ur Rehmanhttps://www.mathworks.com/matlabcentral/profile/15035647-naveed-ur-rehman542072020-01-20T16:20:23Z2020-01-20T16:20:23Zpolyfix(x,y,n,xfix,yfix,xder,dydx)Fit polynomial p to data, but match exactly at one or more points<p>Sometimes we want to fit a polynomial to some data, but want to force a perfect match to some known values at one or more points. This function returns such a polynomial.</p>Are Mjaavattenhttps://www.mathworks.com/matlabcentral/profile/3934907-are-mjaavatten712212019-12-30T10:00:20Z2019-12-30T10:00:20ZImage Segmentation Quality ScoresLet you evaluate the image segmentation quality scores, such TP, FP, TN, FN, Accuracy, Sensitivity, Precision, MCC, Dice, Jaccard<p>Image Segmentation Quality ScoresLet you evaluate the image segmentation quality scores, such TP, FP, TN, FN, Accuracy, Sensitivity, Precision, MCC, Dice, Jaccard==============================================Copyright 2019 by Dang N. H. Thanh. Email: <a href="mailto:thanh.dnh.cs@gmail.com">thanh.dnh.cs@gmail.com</a> Website: <a href="https://sites.google.com/view/crx/sdmYou">https://sites.google.com/view/crx/sdmYou</a> need to install the statistics and Image Processing toolboxes++++++++++++++++++++++++++++++++++++++++++++++Please cite the following papers:Thanh, D. N. H., et al. “BLOOD VESSELS SEGMENTATION METHOD FOR RETINAL FUNDUS IMAGES BASED ON ADAPTIVE PRINCIPAL CURVATURE AND IMAGE DERIVATIVE OPERATORS.” ISPRS - International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, vol. XLII-2/W12, Copernicus GmbH, May 2019, pp. 211–18, doi:10.5194/isprs-archives-xlii-2-w12-211-2019.Thanh, Dang N. H., et al. “A Skin Lesion Segmentation Method for Dermoscopic Images Based on Adaptive Thresholding with Normalization of Color Models.” 2019 6th International Conference on Electrical and Electronics Engineering (ICEEE), IEEE, 2019, doi:10.1109/iceee2019.2019.00030.Thanh, Dang N. H., et al. “Melanoma Skin Cancer Detection Method Based on Adaptive Principal Curvature, Colour Normalisation and Feature Extraction with the ABCD Rule.” Journal of Digital Imaging, Springer Science and Business Media LLC, Dec. 2019, doi:10.1007/s10278-019-00316-x.HOW TO USE:Launch two images: a ground truth segmentation image A and an acquired segmented image B:A = imread('groundtruth.png'); B = imread('segmented.png');And call the function - EvaluateImageSegmentationScores:[Accuracy, Sensitivity, Fmeasure, Precision, MCC, Dice, Jaccard, Specitivity] = EvaluateImageSegmentationScores(A, B)</p>Dang N. H. Thanhhttps://www.mathworks.com/matlabcentral/profile/15306152-dang-n-h-thanh732462020-03-13T05:42:17Z2020-03-13T05:42:17ZPrincipal Component Analysis (PCA) on images in MATLAB (GUI)Principal Component Analysis (PCA) on images in MATLAB (GUI)<p>First, upload a colour image by clicking on the “upload an image button”. The acceptable image formats are png, jpg, jpeg, img and tif. Then click on the "Plot the grayscale image". After that enter the no. of PC's up to which you want to retrieve the images (both colour and grayscale).An error message/box will pop-up when you enter a number greater than the no. of PCs for that particular image. Also, an error will message will pop-up when the entered input is not a number.Please go through this link for detail explanation;<a href="https://medium.com/@abhilash.singh/principal-component-analysis-pca-on-images-in-matlab-a-graphical-user-interface-gui-3d4999ddd0d0Enjoy">https://medium.com/@abhilash.singh/principal-component-analysis-pca-on-images-in-matlab-a-graphical-user-interface-gui-3d4999ddd0d0Enjoy</a>!!!</p>ABHILASH SINGHhttps://www.mathworks.com/matlabcentral/profile/5569287-abhilash-singh108672020-06-15T12:39:13Z2020-06-15T12:39:13Zuipickfiles: uigetfile on steroidsMany-featured, platform independent file and directory picker.<p>This is a GUI application that allows multiple files or directories to be selected and allows you to manage the list (remove files, reorder, etc.) before returning. It has basic filtering as well as regular expression filtering and navigation of the file system is easy. The output is configurable (cell, struct or char arrays). It is written entirely in M and so is platform independent.</p>Douglas Schwarzhttps://www.mathworks.com/matlabcentral/profile/20355-douglas-schwarz698112020-01-23T23:39:54Z2020-01-23T23:39:54ZZfitGUIZfitGUI creates a figure with uimenus devoted to process impedance data<p>The main features are: Graphical. The data can be plotted for each immitance types (Z, Y, C or M), in the complex plane, as well as their real, imaginary parts or their magnitude in function of the frequency (Log/Log scales). Simulation. The possibilities are almost infinite. Over the classical R, C, L electrical elements, one can use CPE (constant Phase Element) and Diffusion Impedances. Fitting. ZfitGUI makes use of the simplex algorithm. To fit only portion of the spectra is user-friendly. Note that there exists the programmatic version of ZfitGUI named "Zfit" which can be found in the Matworks site file exchange.</p>Jean-Luc Dellishttps://www.mathworks.com/matlabcentral/profile/869820-jean-luc-dellis695342020-06-10T17:46:03Z2020-06-10T17:46:03Zautofft - FFT analyzerFrequency analyser useful for interpretation of experimental data or a comparison of theoretical results with measurements.<p>Signal Processing Toolbox™ provides several functions to power spectrum estimation, including pspectrum and stft. Although these functions are excellent and well-documented, they might be cumbersome in some engineering applications. These applications include estimating magnitudes of vibration, noise and other discrete-time signals in engineering units or a comparison of theoretical results with measurements.In such applications, you can use autofft, a Matlab function for estimation of the discrete Fourier transform (DFT) which mimics options of the Brüel & Kjaer FFT analysers. Based on your input, autoFFT segments signal, applies window functions and spectral averaging. The resulting DFT can be returned in various engineering spectral units including magnitude, RMS, peak-to-peak and power spectral density (PSD). autofft can also estimate spectral derivation or spectral integral of DFT and even perform the short-time Fourier transform (STFT).Note that autoFFT requires the Signal Processing Toolbox in order to generate window functions and estimate PSD accurately.If you have any suggestions and comments or if you want to report a bug, feel free to contact me via e-mail carlist(at)ntis.zcu.cz.</p>Lubos Smolikhttps://www.mathworks.com/matlabcentral/profile/7835462-lubos-smolik670182020-06-26T13:19:26Z2020-06-26T13:19:26Zk-Nearest Neighbors (kNN) AlgorithmComplete package<p>Function1. predict_knn2. find_knn3. plot_knnDescription1. Returns the estimated labels of one or multiple test instances and the accuracy of the estimates.2. Returns the k nearest training instances, the k nearest training labels and the respective distances.3. Creates a graphic highlighting the nearest training instances (For plotting, instances must have only two or three features (2-D or 3-D)).Examples using Iris Data Setload fisheririsX = meas;Y = species;Xnew = [min(X);mean(X);max(X)];k = 5;label = predict_knn(X,Y,Xnew,k)label = 'setosa' 'versicolor' 'virginica' Ynew = {'versicolor';'versicolor';'virginica'};[label,accuracy] = predict_knn(X,Y,Xnew,k,Ynew)label = 'setosa' 'versicolor' 'virginica' accuracy = 0.6667See more examples described in the script files.</p>David Ferreirahttps://www.mathworks.com/matlabcentral/profile/8649959-david-ferreira140562020-08-08T10:07:12Z2020-08-08T10:07:12ZArrow3Draws lines with directional arrowheads.<p>ARROW3(P1,P2) draws lines from P1 to P2 with directional arrowheads. P1 and P2 are either nx2 or nx3 matrices. Each row of P1 is an initial point, and each row of P2 is a terminal point.ARROW3(P1,P2,S,W,H,IP,ALPHA,BETA) can be used to specify properties of the line, initial point marker, and arrowhead. Type "help arrow3" at the command prompt for more informationWhat's new in Version 5:All arrowhead and initial point marker sizes (W, H, and IP) are relative to the PlotBox diagonal.Version 5 attempts to preserve the appearance of existing axes. In particular, ARROW3 will not change XYZLim, View, or CameraViewAngle. ARROW3 does not, however, support stretch-to-fill scaling. If a particular aspect ratio or variable limit is required, use DASPECT, PBASPECT, AXIS, or XYZLIM commands before calling ARROW3. Users are encouraged to report problems directly to the author.</p>Tom Davishttps://www.mathworks.com/matlabcentral/profile/1274877-tom-davis736702019-12-13T11:49:49Z2019-12-13T11:49:49ZwaitbarParforWaitbar implementation for parfor loops.<p>This package provides a waitbar for use in parfor loops without the need to write to files or any other external synchronization.</p>Girmi Schoutenhttps://www.mathworks.com/matlabcentral/profile/9452059-girmi-schouten728542020-07-08T12:55:22Z2020-07-08T12:55:22ZModel Execution TimeSimulates a Simulink model a number of times and records/plots the execution time.<p>Simulates a Simulink model a number of times and records the execution time data. The results are then plotted, along with the min, max, and mean times. The user can specify how many simulations to perform.</p>Monika Jaskolkahttps://www.mathworks.com/matlabcentral/profile/4417791-monika-jaskolka746102020-04-11T14:58:18Z2020-04-11T14:58:18ZSimulitis (A Coronavirus Simulation)MATLAB code to replicate Washington Post's Coronavirus simulation<p>I'm sure by now you've all seen the Washington Post article with the COVID-19 simulation, speaking to the public health benefits of social isolation in the face of a highly infectious disease. If you haven't, here's the article: <a href="https://www.washingtonpost.com/graphics/2020/world/corona-simulator/Well">https://www.washingtonpost.com/graphics/2020/world/corona-simulator/Well</a>, out of my quarantine boredom, I recreated this simulation in MATLAB, with more knobs to turn and parameters to play around with. For example, what if some of the carriers can die? What if the disease is Ebola instead (~50% mortality rate)?This function simulates disease transmission among a set of n carriers, in a confined space, with some proportion of carriers socially isolating themselves. A simple multibody physics model (elastic collision between two equal-mass particles) determines carrier trajectory.Hopefully this gives you a fun (albeit brief) respite from the doldrums of social isolation!</p>Joshua Gaffordhttps://www.mathworks.com/matlabcentral/profile/14092049-joshua-gafford503392020-07-31T22:12:07Z2020-07-31T22:12:07ZEasily Simulate Custom Networks of LIF NeuronsDesign and simulate your leaky integrate and fire (LIF) neuron network in only a few lines of code.<p>In only a few lines of code you can customize and simulate a network of leaky integrate and fire neurons (LIF). This function facilitates quick testing of network architectures. The network can be simple, only specifying the weights of the connections between neurons, or complex with options ranging from offset currents, refractory periods, speed of synaptic transmission, noise, etc.Usage notes, extensive examples, and sources are given in the help.</p>Zachary Danzigerhttps://www.mathworks.com/matlabcentral/profile/1044524-zachary-danziger546812020-01-31T18:22:11Z2020-01-31T18:22:11ZFeature fusion using Canonical Correlation Analysis (CCA)Feature level fusion using Canonical Correlation Analysis (CCA)<p>Feature fusion is the process of combining two feature vectors to obtain a single feature vector, which is more discriminative than any of the input feature vectors. CCAFUSE applies feature level fusion using a method based on Canonical Correlation Analysis (CCA). It gets the train and test data matrices from two modalities X and Y, and consolidates them into a single feature set Z. Details can be found in: M. Haghighat, M. Abdel-Mottaleb, W. Alhalabi, "Fully Automatic Face Normalization and Single Sample Face Recognition in Unconstrained Environments," Expert Systems With Applications, vol. 47, pp. 23-34, April 2016. <a href="http://dx.doi.org/10.1016/j.eswa.2015.10.047">http://dx.doi.org/10.1016/j.eswa.2015.10.047</a> (C) Mohammad Haghighat, University of Miami <a href="mailto:haghighat@ieee.org">haghighat@ieee.org</a> PLEASE CITE THE ABOVE PAPER IF YOU USE THIS CODE.</p>Mohammad Haghighathttps://www.mathworks.com/matlabcentral/profile/2857455-mohammad-haghighat728632019-09-26T12:15:27Z2019-09-26T12:15:27ZForward and Inverse kinematics Forward and Inverse kinematics of 6 DOF arm with workspace calculation<p>Forward and Inverse kinematics of 6 DOF arm with workspace calculation</p>hashim khanhttps://www.mathworks.com/matlabcentral/profile/16375576-hashim-khan725342019-10-31T14:20:46Z2019-10-31T14:20:46ZKuramoto's model of synchronizing oscillatorsThe Kuramoto model is a nonlinear dynamic system of coupled oscillators that initially have random natural frequencies and phases.<p>The Kuramoto model is a nonlinear dynamic system of coupled oscillators that initially have random natural frequencies and phases. If the coupling is strong enough, the system will evolve to one with all oscillators in phase. See Cleve's Corner, <a href="https://blogs.mathworks.com/cleve/2019/10/30/stability-of-kuramoto-oscillators/">https://blogs.mathworks.com/cleve/2019/10/30/stability-of-kuramoto-oscillators/</a></p>Cleve Molerhttps://www.mathworks.com/matlabcentral/profile/349729-cleve-moler704502020-06-04T03:48:13Z2020-06-04T03:48:13Zkmz2structConverts KML or KMZ files to a Matlab structure.<p>This function will convert kml and kmz files to a matlab structure. If converting a kmz file it will extract it to a directory called '.kml2struct' in your home directory. This directory will be deleted when the function exits.The output of this function should be similar to 'shaperead' except that it will add another field, "Folder", for the kml folder where the shape was file.This function will only handle kml/kmz files with Point, LineString, and Polygon geometries. If you try to run this on a kml/kmz with different elements those elements will be omitted from the result</p>Nathan Ellingsonhttps://www.mathworks.com/matlabcentral/profile/13305613-nathan-ellingson646922019-08-18T05:10:05Z2019-08-18T05:10:05ZSUNRISE: sunrise and sunset timesComputes sunrise and sunset times from any geographical location on Earth.<p>This function computes sunrise and sunset times from any location on Earth (latitude, longitude and altitude), for a given date and timezone. The function is fully vectorized so any input parameters can be scalars, vectors or matrix (of the same size).Without any argument, sunrise will try to guess your location (needs internet connection).NEW: It is also possible to use two reverse functions:- from the day length, it computes the corresponding latitude;- from sunrise and sunset date/time it computes the corresponding latitude and longitude.Both reverse function need altitude as input argument.Examples:To get sunrise/sunset of your current location: >> sunrise Location: 48.8582 °N, 2.3387 °E, 0 m Sunrise: 10-Oct-2017 08:03:41 +02 Sunset: 10-Oct-2017 19:13:49 +02 Day length: 11h 10mn 8sTo compute the latitude corresponding to 14h of daylight at altitude 0m on April 21, 2019: >> sunrise(14/24,0,'2019-04-21','day2lat') Estimated latitude: 49.076°NTo compute the latitude and longitude corresponding to specific sunrise and sunset times: >> sunrise('22-Apr-2019 04:52:12','22-Apr-2019 18:51:04',0,'sun2ll') Estimated location: 47.9995°N, 2.00142°EType help sunrise or doc sunrise to get syntax and full documentation. See the function code for further explanations.</p>François Beauducelhttps://www.mathworks.com/matlabcentral/profile/1195687-francois-beauducel738952020-01-11T21:18:11Z2020-01-11T21:18:11ZgitToo simple git wrapper makes it possible to call git as if it is a MATLAB command (given you have installed git and added to system path).<p>Too simple git wrapper combines all string arguments, decorates with spaces, appends 'git' and executes the result using MATLAB's system() command. That's it, and nothing else!This tool is made for simple, quick and dirty git usage through MATLAB command prompt. Nothing beyond that is promised.If you need more functionality, check out this link: <a href="https://stackoverflow.com/questions/42271061/matlab-git-by-command-windowUsage">https://stackoverflow.com/questions/42271061/matlab-git-by-command-windowUsage</a> examples:git --versiongit init awesome_projectgit pullgit commit -m 'awesome message'git push...</p>Hiranhttps://www.mathworks.com/matlabcentral/profile/5788470-hiran749932020-04-13T21:51:03Z2020-04-13T21:51:03ZGet sheet names from Excel fileReads the sheet names from Excel file for the given format :: .xls, .xlsm, .xlsx, .xltm, .xltx, .xltm<p>Reads the sheet names from Excel file for the given format :: .xls, .xlsm, .xlsx, .xltm, .xltx, .xltm%%********************************************************************************% Name : xl_xlsfinfo% Author : Pruthvi Raj G% Version : Version 1.0 - 2011b Compactible% Description : Finds all the sheets in the Excel file ( .xls, .xlsm, .xlsx, .xltm, .xltx, .xltm)% Input : File_Name with path included.% Date : 11-Feb-2020%% Examples : xl_xlsfinfo('D:\Pruthvi\Test_file.xls')%*********************************************************************************</p>Pruthvi Raj Gampalwarhttps://www.mathworks.com/matlabcentral/profile/10761452-pruthvi-raj-gampalwar729982019-10-11T14:31:01Z2019-10-11T14:31:01ZCircles Detection using Hough TransformThe code detects the circles in an image using Hough Transform.<p>Complete Algorithm Steps% 1. Reading an Image% 2. Convert to GrayScale% 3. Detecting Edges% 4. Defining an Accumulator Matrix% 5. Finding the Circles Centers with Equation of Circle Using value of Radius% 6. Assigning Values in the Accumulator Matrix% 7. Finding Peak Values (Centre of Circles)% 8. Plotting Circles on Original Colour Image</p>Rao Farhat Masoodhttps://www.mathworks.com/matlabcentral/profile/714659-rao-farhat-masood710532020-07-10T05:20:14Z2020-07-10T05:20:14Zfigure2pdfFIGURE2PDF exports the current MATLAB figure to a PDF file.<p>FIGURE2PDF exports the current MATLAB figure to a PDF file.This function is useful for preparing high-quality graphic files for research papers.</p>Ildeberto de los Santos Ruizhttps://www.mathworks.com/matlabcentral/profile/5153703-ildeberto-de-los-santos-ruiz747622020-03-29T18:35:09Z2020-03-29T18:35:09ZSIRModelSimulation% This file simulates SIR model for the spread of infectious diseases<p>% Np = the population of the community. (Default = 100, so you easily % read the percentage of the community infectious/infected)% Ni = the number of index case (initial infecious individual, Default = 1).% Ds = is the minimum safe distance below which the probability of being % infected is Prinf (Measure of how contagious the disease is: % Lower means more contagious. Default = 0.05).% Prinf = probability that you will be infected if you are closer than Ds % to an infectious iindividial (Measure of how precautious people % are: washing hands, not touching mucus membrane. Default = 0.2).% Tr = Time it takes for an individual to be removed from the population % (Death, Quarantined, Recovered and become immuned. Default = 1).% F = Relative repulsive force strength (measure of social distancing Default = 1)% videoname = Simulation video file name</p>Lateef Adewale Kareemhttps://www.mathworks.com/matlabcentral/profile/2376472-lateef-adewale-kareem608662020-02-28T03:24:14Z2020-02-28T03:24:14Zpairplot(meas, label, group, colors, mode)plot pairwise relationships in matrix<p>plot pairwise relationships in matrix : similar to 'pairplot' in seaborn (<a href="http://seaborn.pydata.org/generated/seaborn.pairplot.html)easier">http://seaborn.pydata.org/generated/seaborn.pairplot.html)easier</a> than 'plotmatrix'% e.g. % For stat toolbox users load fisheriris.mat colors = lines(3); label = {'sepal-length', 'sepal-width', 'petal-length', 'petal-width'} figure; pairplot(meas, label, species, colors, 'both');% For all users load Fisher.mat % included in zip group= Fisher(:,1); colors = lines(length(unique(group))); figure; pairplot(Fisher(:,2:size(Fisher,2)), {'PW', 'PL', 'SW', 'SL'}, num2cell(num2str(group)), colors, 'bar'), ylabel('Probability') figure; pairplot(meas, label, species, colors, 'both');</p>Ryosuke F Takeuchihttps://www.mathworks.com/matlabcentral/profile/3438634-ryosuke-f-takeuchi761982020-05-28T04:12:37Z2020-05-28T04:12:37Zgif2aviConverts GIF images to AVI (or MP4) video files.<p>gif2avi(file) converts a gif file to an avi video and saves it to the current directory. gif2avi(file, destination) specifies where the avi file should be saved and its file name. gif2avi(file, '.mp4') converts to mp4 file.gif2avi(file, [ ], 'nLoops', n) records the gif loop n-times.Set the profile (output file type), FrameRate, Colormap, and Quality in VideoWriter by using name-value parameter inputs.aviFile = gif2avi(__) returns the full path to the avi file. [~, vidObj] = gif2avi(__) returns the VideoWriter object.When complete, a message is printed to the command window indicating the location of the output file. Special thanks to Walter Roberson for feedback that improved this submission. </p>Adam Danzhttps://www.mathworks.com/matlabcentral/profile/3753776-adam-danz753232020-05-02T15:03:19Z2020-05-02T15:03:19ZRadar Basic SimulationRoundtrip Time Computation <p>A simple radar simulation which computes the roundtrip time of radar pulse based on the radar distance traveled.</p>Bryan Nograhttps://www.mathworks.com/matlabcentral/profile/18152830-bryan-nogra787242020-08-14T23:07:38Z2020-08-14T23:07:38ZdashedlinePlot dashed line<p>Simple function to plot a straight dashed line with custom dash width. Gap width = dash width.% DASHEDLINE(X,Y) plots a dashed line on the current axis along X and% Y, with dash and gaps equal to 2 points. X and Y should each have% exactly two elements defining the start and end of the line%% DASHEDLINE(X,Y, WIDTH) plots a dashed line with dash and gaps equal to% WIDTH points%% H = DASHEDLINE(X,Y,...) returns a handle to the dashed line%%% Example:% x = get(gca,'XLim');% y = [0 0];% dashedline(x, y, 4)%% Note 1: the dash width is adjusted slightly to ensure a dash is present% at the beginning and end of the line%% Note 2: point measurement assumes the dashed line is plotted along the% whole width or height of the axis, otherwise it will be slightly off.% 1 pt = 1/72 in = .3528 mm%% Includes plotboxpos, copyright 2010 Kelly Kearney</p>Myrtle42https://www.mathworks.com/matlabcentral/profile/6250207-myrtle42704472020-04-04T16:21:28Z2020-04-04T16:21:28ZFast Global Stiffness Matrix AssemblyGenerates global stiffness matrix from elements stiffness matrices in a fast way<p>function K=Fast_Matrix_Assembly(Elements) Input:---------Elements: a structure contains Elements{i}.K and Elements{i}.DOFs (Stiffness and Degrees of freedoms of the ith element).output:---------K: Sparse global stiffness matrixReferences-----------------Cuvelier, François, Caroline Japhet, and Gilles Scarella. "An efficient way to perform the assembly of finite element matrices in Matlab and Octave." arXiv preprint arXiv:1305.3122 (2013).</p>Ayad Al-Rumaithihttps://www.mathworks.com/matlabcentral/profile/6310243-ayad-al-rumaithi683412019-11-06T11:27:29Z2019-11-06T11:27:29ZReadCompressedJpegSEQRead compressed or uncompressed monochrome NorPix image sequence in MATLAB.This script can read all frames or a set reading window.<p>Read compressed or uncompressed monochrome NorPix image sequence in MATLAB.This script can read all frames or a set reading window.Reading window for compressed sequences requires a separate .idx filenamed as the source file (eg. test.seq.idx).INPUTS fileName: String containing the full path to the sequence frames: 1x2 double array of beginning and end frameOUTPUTS ImageCellArray: Cell array with images and timestamps of all allocated frames. headerInfo: Struct with header information (ImageWidth, ImageHeight, ImageBitDepth, ImageBitDepthReal, ImageSizeBytes, ImageFormat, AllocatedFrames, Compression, HeaderVersion, HeaderSize, Description, TrueImageSize, FrameRate).EXAMPLES Read frames 2 to 13: ImageCellArray = ReadJpegSEQ('C:\test.seq',[2 13]) Read all frames: ImageCellArray = ReadJpegSEQ('C:\test.seq',[0 0]) Show header information: [ImageCellArray, headerInfo] = ReadJpegSEQ('C:\test.seq',[0 0])Last modified 06.11.2019 by Paul Siefert, PhDGoethe-University <a href="mailto:Frankfurtsiefert@bio.uni-frankfurt.deBased">Frankfurtsiefert@bio.uni-frankfurt.deBased</a> on the work of Brett Shoelson (Norpix2MATLAB_MarksMod.m)Thanks to NorPix support (Daniel Wang) for providing sequence informationThis code was tested with Norpix SEQ8-bit monochrome 75% lossy jpeg compression (24.07.2018)8-bit monochrome uncompressed (03.06.2019)Please report any bugs and improvement suggestions</p>Paul Sieferthttps://www.mathworks.com/matlabcentral/profile/8337810-paul-siefert720922020-07-24T18:28:42Z2020-07-24T18:28:42Z2D Vortex Core Tracking - Gamma 1 - Super FastIdentifies 2D vortices using Gamma 1 from Graftieaux<p>Based on and inspired by Sebastian Endrikat <a href="https://www.mathworks.com/matlabcentral/fileexchange/52343-find-vortices-in-velocity-fieldsUnderlying">https://www.mathworks.com/matlabcentral/fileexchange/52343-find-vortices-in-velocity-fieldsUnderlying</a> math presented by L Graftieaux "Combining PIV, POD and vortex identification algorithms for the study of unsteady turbulent swirling flows" <a href="https://iopscience.iop.org/article/10.1088/0957-0233/12/9/307/pdfThanks">https://iopscience.iop.org/article/10.1088/0957-0233/12/9/307/pdfThanks</a> a lot!Sebastian's code is rather slow, though, because it uses 4 nested for loops. Producing the gamma1 map can be done more efficiently in Matlab by realizing that the operations described in the Graftieaux's paper can be rearranged into two convolutions. This code does that, basically. It also find the maximum gamma 1 by fitting a spline curve, therefore not being limited by the grid resolution of the vector field.The drawback is that it'll find only one vortex core, which might not be desired in some applications where multiple vortices form. One can, however, use the second output (G1) to perform their own peak finding/thresholding to find multiple vortex cores.Write-up of the details on <a href="https://zigunov.com/2019/07/08/finding-vortex-cores-with-gamma-1/Hope">https://zigunov.com/2019/07/08/finding-vortex-cores-with-gamma-1/Hope</a> it was useful!-FZ</p>Fernando Zigunovhttps://www.mathworks.com/matlabcentral/profile/10721836-fernando-zigunov222392020-06-11T01:52:38Z2020-06-11T01:52:38Znum2strexact (exact version of num2str)num2strexact does exact conversion of number to string based on IEEE floating point bit pattern<p>num2strexact is a self-building C-mex function that converts a double or single input to the exact decimal string. The conversion is done with hundreds of digits of precision to maintain the exact conversion. The conversion uses the exact decimal value of each bit of the IEEE double precision floating point format along with the exact application of 2^exponent. Inf and NaN bit patterns are recognized, and denormalized numbers are handled also.Don't confuse the exact conversion with significance! Double numbers will only be significant to about 15 decimal digits, and single numbers will only be significant to about 7 decimal digits. For example,>> format hex>> 1.2ans = 3ff3333333333333>> num2strexact(1.2)ans = 1.1999999999999999555910790149937383830547332763671875>> 1.2 + eps(1.2)ans = 3ff3333333333334 <-- one bit different from 1.2num2strexact(1.2 + eps(1.2))ans = 1.20000000000000017763568394002504646778106689453125>> num2strexact(eps(1.2))ans = 2.220446049250313080847263336181640625e-16You can see that 1.2 is not represented exactly in IEEE double format. The difference shows up in the 18th digit for this example. Then note that the very next number in the IEEE double format model is about 2e-16 bigger. The exact conversions are shown for each number, but they are not significant beyond the 16th digit shown. There are no numbers in between these two numbers that can be represented in IEEE double format.Syntax: Y = num2strexact(X [,'fixed' or 'float']) [Y1 Y2] = num2strexact(X1,X2 [,'fixed' or 'float']) [Y1 Y2 Y3] = num2strexact(X1,X2,X3 [,'fixed' or 'float']) : : etc etcX = double or single or halfNOTE: The half type can be input in one of two ways: 1) A uint16 class variable containing the half bit patterns 2) A half class variable. num2strexact must have access to the underlying bit patterns, so if you input a half class variable, then this will first be converted to the equivalent integer bit patterns with the storedInteger function (a temporary deep copy).The number of inputs must match the number of outputs, except in thespecial case of 1 input and 0 outputs where the result will simply beput into ans. If the input is a scalar, the output will be a char string.If the input is any other size array, the result will be a cell array ofthe same dimensions as the input, with each cell containing the charstring conversion of the corresponding element.The optional 'fixed' argument forces the result to be fixed point.The optional 'float' argument forces the result to be floating point. Allnumbers will be printed with exponents, even if the exponent is 0.The default will be fixed or floating point depending on the size of thedecimal exponent. Numbers with -1 <= (decimal exponent) <= 2 will bedisplayed as fixed point, else the number will be displayed as floatingpoint.All NaN bit patterns, regardless of the sign bit and payload, will bereturned simply as the string 'NaN'.Infinity bit patterns will be returned as 'Inf' or '-Inf' as appropriate.num2strexact gives similar results to the following NUM2IEEE function by Steven Lord:<a href="http://www.mathworks.com/matlabcentral/fileexchange/2996except">http://www.mathworks.com/matlabcentral/fileexchange/2996except</a> that num2strexact does not require the Symbolic Math Toolbox to display the potentially hundreds of exact digits, and num2strexact runs much faster.</p>James Tursahttps://www.mathworks.com/matlabcentral/profile/756104-james-tursa721242020-08-10T12:58:03Z2020-08-10T12:58:03Zfft_plot functionPlot signal FFT norm and phase versus frequency and signal versus time.Customizable display, also return FFT data.<p>Function can also return fft results.optionnal input argument:- 'legend': 'signal name'- 'title': 'your title'- 'window': 'none', 'hann', 'hamming', 'flattop', 'blackman', 'blackmanharris'- 'subplot': 'fft', 'fft_signal', 'fft_angle', 'all', 'none'- 'MinNorm': if norm is lower than this value, angle is forced to 0.(angle makes no sense for small norm)- 'H1': replace frequency axis with harmonic number (divide frequency axis by H1)- 'fmin': display frequency fmin to fs/2 (if H1 != 1 then fmin = Harmonic min)- 'fmax': display frequency 0 to fmax (if H1 != 1 then fmax = Harmonic max)- 'Amax': display amplitude 0 to Amax- 'style': 'line', 'stem', 'bar', 'stairs', 'area', (fft norm only)- 'scale': 'linear', 'semilogx', 'semilogy', 'loglog' - 'linewidth': number (defaut is 0.5)</p>pierre-alexandre chauvenethttps://www.mathworks.com/matlabcentral/profile/9594986-pierre-alexandre-chauvenet554052020-01-31T18:18:13Z2020-01-31T18:18:13ZFeature fusion using Discriminant Correlation Analysis (DCA)Feature fusion using Discriminant Correlation Analysis (DCA)<p>Feature fusion is the process of combining two feature vectors to obtain a single feature vector, which is more discriminative than any of the input feature vectors. DCAFUSE applies feature level fusion using a method based on Discriminant Correlation Analysis (DCA). It gets the train and test data matrices from two modalities X and Y, along with their corresponding class labels and consolidates them into a single feature set Z. Details can be found in: M. Haghighat, M. Abdel-Mottaleb, W. Alhalabi, "Discriminant Correlation Analysis: Real-Time Feature Level Fusion for Multimodal Biometric Recognition," IEEE Transactions on Information Forensics and Security, vol. 11, no. 9, pp. 1984-1996, Sept. 2016. <a href="http://dx.doi.org/10.1109/TIFS.2016.2569061">http://dx.doi.org/10.1109/TIFS.2016.2569061</a> and M. Haghighat, M. Abdel-Mottaleb W. Alhalabi, "Discriminant Correlation Analysis for Feature Level Fusion with application to multimodal biometrics," IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), 2016, pp. 1866-1870. <a href="http://dx.doi.org/10.1109/ICASSP.2016.7472000">http://dx.doi.org/10.1109/ICASSP.2016.7472000</a> (C) Mohammad Haghighat, University of Miami <a href="mailto:haghighat@ieee.org">haghighat@ieee.org</a> PLEASE CITE THE ABOVE PAPER IF YOU USE THIS CODE.</p>Mohammad Haghighathttps://www.mathworks.com/matlabcentral/profile/2857455-mohammad-haghighat643832020-07-06T09:45:10Z2020-07-06T09:45:10ZfindNDfind for 3D or ND<p>This function replicates the syntax for the built-in function 'find', but extends it to more dimensions.It is compatible with all releases up to and including MATLAB 6.5. For that release, the built-in find function doesn't support the find(X,K) syntax or find(X,K,side), while this function does.I have no access to even older releases, so I can't test compatibility, although I suspect this will work a few releases before 6.5.Licence: CC by-nc-sa 4.0</p>Rikhttps://www.mathworks.com/matlabcentral/profile/3073010-rik747152020-07-21T19:23:30Z2020-07-21T19:23:30ZSuperjetExtension of jet colormap to include more colors. It can also be used to build virtually any custom colormaps.<p>Superjet is a general function for colormap building. I originally wrote it back in the days when jet was the default colormap and it was designed as an extension of jet to include black and white. It is used like every other MATLAB built-in colormap functions like jet, hot or parula.If called without output argument it will show the colormap on a figure.superjet(); returns a 256–by–3 matrix containing an extension of jet colormap going through black–purple–blue–cyan–green–yellow–orange–red–pink–white.superjet(N); returns an N–by–3 matrix containing superjet colormap where N is the number of colors.superjet(N,option); returns the N–by–3 colormap with the following options:'pale': Superjet is provided with pale colours.'dark': Superjet is provided with dark colours. 'cyclic': Superjet starts and ends with the same color (designed for representation of angles).'many': Designed to obtain many distinctive colours instead of a progressive color scale. A combination of normal,dark and pale is returned.'lines': The same as 'many' but in this case the colormap is shuffled.'all': All preset colors are shown with their associated character.'dictionary': Same as 'all' but they are sorted alphabetically.superjet(N,colors); returns an N–by–3 colormap where colors is a string specifying the colors. The string can have however many characters from the following table. k – blacky – yellowc – cyanm – magentaw – whiteg – greenr – red b – blue v – violet p – pink j – jadeo – orangeu – purple i – indigo q – quartz l – lime a – amber d – denim n – brown s – salmon t – turquoise 2 – gray24 – gray46 – gray68 – gray8Run superjet(‘all’); to see the complete list.Example calls: cm=superjet('kg'); % will produce a black to green colormap cm=superjet('k123456789w'); % will produce a colormap similar to gray() cm=superjet(200,'kroyw'); % will produce a colormap similar to hot(200)– AlexV</p>Alexander Vallmitjana Leeshttps://www.mathworks.com/matlabcentral/profile/16661308-alexander-vallmitjana-lees699722020-07-06T00:13:01Z2020-07-06T00:13:01Zvarargin2optParse varargin cells to option structures<p>This function parses a content of a cell with `{key,value,...}` pairs (usually `varargin`) into an option with fields `opt.key = value`. It allows one to specify input specification and supply validator functions. This is a utility function based on Matlab's `inputParser`.</p>Marcin Konowalczykhttps://www.mathworks.com/matlabcentral/profile/4612692-marcin-konowalczyk737512019-12-21T20:02:28Z2019-12-21T20:02:28ZStructural Dynamics: Total response of a damped systemDynamic Analysis: Total response of a damped system<p>This function determines total response of a damped systemInput: Mass, Damping coefficient, Stiffness, Excitation force Output: The file calculates the total response of a damped system including the followings: -Natural circular frequency -Critical damping coefficient -Relative critical viscous damping -Damped circular frequency -Total solution as sum of homogenous and particular solution -Plotting displacement as a function of timeHow to use the function:- Step 1: Derive the equation of motion for the whole system in order to obtain total mass, damping, stiffness and excitation values.- Step 2: Determine the particular solution of the system.- Step 3: Determine the coefficients A & B in the homogenous solution according to the initial conditions, so that when (t=0) for u(t), coefficient A is obtained. Derive u(t) and set (t=0) and with help of A, the coefficient B could be obtained.- Step 4: Determine the total solution as a sum of homogenous solution and particular solution.- Step 5: Plot the result.Extra information: Try to experiment on increasing/ decreasing the value of the damping coefficient in order to see the decaying of the vibration.If the system is SDOF and free vibration wants to be plotted, ignore the exciting force & particular solution.</p>Benjamin Bondsmanhttps://www.mathworks.com/matlabcentral/profile/16085184-benjamin-bondsman687712020-07-17T08:01:30Z2020-07-17T08:01:30ZTable SQLA script for performing SQL CRUD operations on Matlab tables.<p># INTRODUCTION #Basically, this script is a SQL wrapper around Matlab tables. It is especially useful for those who are new to Matlab and have the habit of "thinking in SQL", or for those who need to accomplish complex data manipulation tasks and struggle to achieve them with the built-in table manipulation functions.# METHODOLOGY & USAGE #The "table_sql" function accepts a single input argument, which must be a valid SQL CRUD statement (DELETE, INSERT, SELECT or UPDATE) where the table names refer to ordinary Matlab tables defined within the main workspace.Once the query is parsed, the script sets up an in-memory instance of the SQLite database, imports the tables, performs the specified SQL statement, synchronizes the workspace tables with the database and returns the result. The content of the latter depends upon the performed operation:> for SELECT statements, an m-by-n table representing the result set returned by the database;> for DELETE, INSERT and UPDATE statements, an integer representing the number of affected rows.# EXAMPLES #1) Setup:load('patients');ids = (1:numel(LastName)).';t1 = table(ids,LastName,Gender,'VariableNames',{'ID' 'LastName' 'Gender'});t2 = table(ids,Age,Height,Weight,'VariableNames',{'ID' 'Age' 'Height' 'Weight'});2) Selections (with and without assignment):t3 = table_sql('SELECT A.ID, A.LastName, B.Age FROM t1 A INNER JOIN t2 B ON B.ID = A.ID');table_sql('SELECT Age, AVG(Height) FROM t1 A INNER JOIN t2 B ON B.ID = A.ID GROUP BY Age ORDER BY Age');3) Modifications:ar = table_sql('DELETE FROM t1 WHERE Gender = "Male"'); t1ar = table_sql('UPDATE t2 SET Age = Age + 1 WHERE Age >= 40'); t2# NOTES #> The script requires a SQLite JDBC driver, which can be downloaded from the following link: <a href="https://bitbucket.org/xerial/sqlite-jdbc/downloads/">https://bitbucket.org/xerial/sqlite-jdbc/downloads/</a>. The ".jar" file must be placed in the script folder.> The column types of the tables being queried are normalized as follows: categoricals and strings become character arrays, logicals become 8-bit integers (bytes), integers become doubles.</p>Tommaso Belluzzohttps://www.mathworks.com/matlabcentral/profile/9773769-tommaso-belluzzo603472020-05-27T10:52:29Z2020-05-27T10:52:29ZtoggleToolboxToggle MATLAB toolboxes on or off<p>Utility to enable/disable MATLAB toolboxes.S = TOGGLETOOLBOX()S = TOGGLETOOLBOX('')S = TOGGLETOOLBOX('all') queries the on/off states of all installedtoolboxes.M = TOGGLETOOLBOX('names') returns the full names / directory names map[M] applicable to the current MATLAB installation.S = TOGGLETOOLBOX(toolbox, state) queries or sets the on/off state of theMATLAB toolbox [toolbox] to [state]. The string or cellstring [toolbox] maybe equal to the toolbox' installation directory name (the same as used byver()), or the toolbox' full name. The string [state] may be one of 'on','off' or 'query'. The return argument [S] is a structure containing thetoolbox name(s) as fields, with the on/off state represented as true/false.S = TOGGLETOOLBOX(..., permanency) for string [permanency] equal to'permanent' will attempt to make the change persist between differentMATLAB sessions. For [permanency] equal to 'temporary' (the default), thechange will only last for the remainder of the current session.TOGGLETOOLBOX(S0) will reset the on/off states of all toolboxes to thestates contained in [S0], where [S0] is a structure previously returned byTOGGLETOOLBOX() as outlined above.Disabling a toolbox is done by removing the relevant directories from theMATLAB path. Since the order of the path is important for name resolution,TOGGLETOOLBOX() attempts to keep the order of all paths as close to MATLAB'sstartup path as possible. Calling TOGGLETOOLBOX() multiple times for differenttoolboxes and arbitrary on/off states should not affect the overall pathorder -- calling TOGGLETOOLBOX('all', 'on') afterwards results in a pathidentical to the startup path.Note that TOGGLETOOLBOX() generates a MAT file for both performance andpersistence between MATLAB sessions or across platforms. Please make sure that TOGGLETOOLBOX() is located in a directory where it has write access.EXAMPLE SESSION: >> M = toggleToolbox('names')% M = 'aero' 'Aerospace Toolbox' 'aeroblks' 'Aerospace Blockset' 'bioinfo' 'Bioinformatics Toolbox' 'comm' 'Communications Toolbox' ... >> S = toggleToolbox({'Aerospace Toolbox' 'Wavelet Toolbox'}, 'query') S = aero: 1 wavelet: 1 >> w = ver('wavelet') w = Name: 'Wavelet Toolbox' Version: '4.5' Release: '(R2010a)' Date: '25-Jan-2010' >> S = toggleToolbox({'Aerospace Toolbox' 'Wavelet Toolbox'}, 'off'); >> toggleToolbox({'Aerospace Toolbox' 'Wavelet Toolbox'}, 'query') ans = aero: 0 wavelet: 0 >> w = ver('wavelet') w = 0x0 struct array with fields: Name Version Release Date >> toggleToolbox(S); >> toggleToolbox({'Aerospace Toolbox' 'Wavelet Toolbox'}, 'query') ans = aero: 1 wavelet: 1 >> % Cross-platform developer mode: >> S = toggleToolbox('all', 'off');</p>Rody Oldenhuishttps://www.mathworks.com/matlabcentral/profile/1711536-rody-oldenhuis723962019-08-08T11:24:22Z2019-08-08T11:24:22ZFast Principal Component Analysis for high dimensional dataWhen analyzing very high-dimensional data, this implementation of Principal Component Analysis is much faster than MATLAB's pca.m.<p> [COEFF,SCORE,LATENT,EXPLAINED] = fastpca(data) Fast principal component analysis for very high dimensional data (e.g. voxel-level analysis of neuroimaging data), implemented according to C. Bishop's book "Pattern Recognition and Machine Learning", p. 570. For high-dimensional data, fastpca.m is substantially faster than MATLAB's in-build function pca.m. According to MATLAB's PCA terminology, fastpca.m needs an input-matrix with each row represents an observation (e.g. subject) and each column a dimension (e.g. voxel). fastpca.m returns principal component (PC) loadings COEFF, PC scores (SCORE), variances explained by the PCs in absolute values (LATENT) and in percent (EXPLAINED). Additionally, fastpca returns the PC loading of the small covariance matrix (COEFFs).Decrease in computation time results from calculating the PCs from the (smaller) covariance matrix of the transposed input-matrix "data" instead of the large covariance matrix of the original input matrix which are then use to project the observations to achieve the PCs of the large DxD covariance matrix. By default, fastpca removes the mean of each observation. In this first implementation of fastpca, I skipped calculation of Hotelling’s T-Squared Statistic as I didn't need it so far.Example:In medical image analysis, there are often datasets with few to several hundreds of observations (subjects) and hundreds of thousands dimensions (voxels). As an example, I compare MATLABs PCA and fastpca using a random matrix with 300 rows (e.g. subjects) and 500000 columns (e.g. voxels): data = rand(300,500000);tic; [COEFF,SCORE,LATENT,~,EXPLAINED] = pca(data); toc>> Elapsed time is 37.295108 seconds.tic; [COEFF,SCORE,LATENT,EXPLAINED] = fastpca(data); toc>> Elapsed time is 4.853614 seconds.Version 1.0 from 08/08/2019. Implemented by Dominik Blum. E-Mail: <a href="mailto:dominik.blum@med.uni-tuebingen.deHomepage">dominik.blum@med.uni-tuebingen.deHomepage</a>: <a href="https://www.medizin.uni-tuebingen.de/de/das-klinikum/mitarbeiter/profil/284?search=dominik20Blum&mode=popup">https://www.medizin.uni-tuebingen.de/de/das-klinikum/mitarbeiter/profil/284?search=dominik20Blum&mode=popup</a></p>Dominik Blumhttps://www.mathworks.com/matlabcentral/profile/8484530-dominik-blum742852020-02-18T10:35:36Z2020-02-18T10:35:36ZDiscrete Wigner-Ville DistributionDiscrete Wigner-Ville Time Frequency Analysis<p>The present code is a Matlab program for Discrete Wigner-Ville Time-Frequency analysis of a given (non-stationary) signal.% Discrete Wigner-Ville Distribution% x = Input Signal% fs = sampling rate% K = Kernel values% DVW = DWVT%This program is free software; you can redistribute it and/or modify</p>Haider Rizvihttps://www.mathworks.com/matlabcentral/profile/4789618-haider-rizvi637942019-12-11T18:30:36Z2019-12-11T18:30:36ZPermutaton entropy with tied ranks (fast algorithm)Permutation entropy for ordinal patterns with tied ranks from 1D time series in sliding windows<p>function ePE = PEeq( x, delay, order, windowSize )efficiently [UK13] computes permutation entropy [BKP02] for the case of ordinal patterns with tied ranks [BQM2012,UK13,U15] in maximally overlapping sliding windows (see more ordinal-patterns based measures at <a href="http://www.mathworks.com/matlabcentral/fileexchange/63782-ordinal-patterns-based-analysis--beta-version-">http://www.mathworks.com/matlabcentral/fileexchange/63782-ordinal-patterns-based-analysis--beta-version-</a>) for orders=1...7 of ordinal patterns with tied ranks. NOTES1 Order of ordinal patterns is defined as in [1,3,7,8], i.e. order = n-1 for n defined as in [UK13]2 The values of permutation entropy are normalised by log((order+1)!) so that they are from [0,1] as proposed in the original paper [BKP02].CITING THE CODE [1] Unakafova, V.A., Keller, K., 2013. Efficiently measuring complexity on the basis of real-world data. Entropy, 15(10), 4392-4415. [2] Unakafova, V.A. (2015). Fast permutation entropy, MATLAB Central File Exchange. Retrieved Month Day, Year.INPUT- indata - considered time series- delay - delay between points in ordinal patterns with tied ranks (delay = 1 means successive points)- order - order of the ordinal patterns with tied ranks (order+1 - number of points in ordinal patterns with tied ranks)- windowSize - size of sliding windowOUTPUT- outdata - values of permutation entropy for ordinal patterns with tied ranksEXAMPLE OF USE (with a plot):indata = rand( 1, 7777 ); % generate random data pointsfor i = 4000:7000 % generate change of data complexityindata( i ) = 4*indata( i - 1 )*( 1 - indata( i - 1 ) );enddelay = 1; % delay 1 between points in ordinal patterns (successive points)order = 3; % order 3 of ordinal patterns (4-points ordinal patterns)windowSize = 512; % 512 ordinal patterns in one sliding windowoutdata = PEeq( indata, delay, order, windowSize );figure;ax1 = subplot( 2, 1, 1 ); plot( indata, 'k', 'LineWidth', 0.2 );grid on; title( 'Original time series' );ax2 = subplot( 2, 1, 2 );plot( length(indata) - length(outdata)+1:length(indata), outdata, 'k', 'LineWidth', 0.2 );grid on; title( 'Values of permutation entropy for ordinal patterns with tied ranks' );linkaxes( [ ax1, ax2 ], 'x' );The method is based on precomputing values of successive ordinal patterns of order d, using the fact that they are "overlapped" in d points, and on precomputing successive values of the permutation entropy related to "overlapping" successive time-windows [1].CHOICE OF ORDER OF ORDINAL PATTERNS The larger order of ordinal patterns is, the better permutation entropy estimates complexity of the underlying dynamical system [KUU14]. But for time series of finite length too large order of ordinal patterns leads to an underestimation of the complexity because not all ordinal patterns representing the system can occur [KUU14]. Therefore for practical applications, orders = 3...7 are often used [BP02,RMW13,ZZR12]. In [AZS08] the following rule for choice of order is recommended: 5*(order + 1)! < windowSize.CHOICE OF SLIDING WINDOW LENGTH Window size should be chosen in such way that time series is stationary within the window (for example, for EEG analysis 2 seconds sliding windows are often used) so that distribution of ordinal patterns would not change within the window [BKP02,KUU14(Section 2.2),U15(Section 5.1.2)].CHOICE OF DELAY BETWEEN POINTS IN ORDINAL PATTERNS I would recommend choosing different delays and comparing results (see, for example, [KUU14, Section 2.2-2.4] and [U15, Chapter 5] for more details) though delay = 1 is often used for practical applications. Choice of delay depends on particular data analysis you perform [RWM13,KUU14] and on sampling rate of the data. For example, if you are interested in low-frequency part of signals it makes sense to use larger delays.REFERENCES[BKP02] Bandt C., Pompe B., 2002. Permutation entropy: a natural complexity measure for time series. Physical review letters, APS[BQM2012] Bian, C., Qin, C., Ma, Q.D. and Shen, Q., 2012. Modified permutation-entropy analysis of heartbeat dynamics. Physical Review E, 85(2), p.021906.[UK13] Unakafova, V.A., Keller, K., 2013. Efficiently Measuring Complexity on the Basis of Real-World Data. Entropy, 15(10), 4392-4415. [U15] Unakafova, V.A., 2015. Investigating measures of complexity for dynamical systems and for time systems (Doctoral dissertation, Lübeck, Univ., Diss., 2015).</p>Valentina Unakafovahttps://www.mathworks.com/matlabcentral/profile/4762096-valentina-unakafova772842020-06-26T05:48:34Z2020-06-26T05:48:34ZStructure and object to JSONSave struct and object variables as a JSON file<p>saves the values in the structure 'data' to a file in JSON format.Based on the work of Lior Kirsch at: <a href="https://uk.mathworks.com/matlabcentral/fileexchange/50965-structure-to-jsonModification">https://uk.mathworks.com/matlabcentral/fileexchange/50965-structure-to-jsonModification</a> by Arthur Y.C. Liu 24/06/2020Example: data.name = 'chair'; data.color = 'pink'; data.metrics.imageSize = [1920; 1080]; data.metrics.height = 0.3; data.metrics.width = 1.3; saveJSONfile(data, 'out.json');Output 'out.json':{"name" : "chair","color" : "pink","eye" : [1,0,0,0,1,0,0,0,1],"metrics" : {"imageSize" : [1920,1080],"height" : 0.3,"width" : 1.3}}</p>Arthur LIUhttps://www.mathworks.com/matlabcentral/profile/4687901-arthur-liu756532020-05-20T11:53:23Z2020-05-20T11:53:23ZELMELM with accuracy, sensitivity and specificity calculation<p>Modification Extreme Learning Machine code from MR QIN-YU ZHU AND DR GUANG-BIN HUANG by adding calculation of sensitivity and specificity</p>muhammad mahdi ramadhanhttps://www.mathworks.com/matlabcentral/profile/13326086-muhammad-mahdi-ramadhan660882020-08-05T19:09:15Z2020-08-05T19:09:15ZedfreadUntilDone(fname, varargin)This file is a modification of edfread; it is meant to overcome filesize limitations of the former.<p>If my edfread function fails on your file, try edfreadUntilDone.NOTE: Support for this function is being deprecated. Please see:<a href="https://blogs.mathworks.com/pick/2020/07/10/deprecating-support-for-edfread-and-edfreaduntildone/">https://blogs.mathworks.com/pick/2020/07/10/deprecating-support-for-edfread-and-edfreaduntildone/</a></p>Brett Shoelsonhttps://www.mathworks.com/matlabcentral/profile/845693-brett-shoelson703482020-04-07T21:40:03Z2020-04-07T21:40:03ZDraw randomly centered circles of various sizesSet the range of radii, density, and other parameters to create a plot that draws randomly centered polygons with or without overlap.<p>This function plots circles or other polygons at random positions with varying radii. All input parameters are optional including the axes size, the range of radii, number of vertices per bubble (eg, polygon shape), density, the amount of space between bubbles or how much they can overlap, how they should fit within the figure, and other parameters. A figure is produced and there are four outputs that allow the user to make further changes to the plotted objects or to recreate the exact same plot. More detail is included at the top of the function and I've provided examples of how to use the outputs to add color, calculate the area of each circle, count the number of circles for each circle size, etc. Follow this page for updates.</p>Adam Danzhttps://www.mathworks.com/matlabcentral/profile/3753776-adam-danz753472020-05-05T12:25:59Z2020-05-05T12:25:59ZManSegA mean linear intercept (MLI) method program for analysing micrographs of any type.<p>ManSeg is GUI based program for applying the mean linear intercept (MLI) method for analysing micrographs of any type where by eye it is possible to distinguish grain or phase boundaries in metals or ceramics.The graphical user interface is designed to take the less boring bits out of counting thousands of particles. The philosophy behind ManSeg is that the software detects all possible interfaces on a test line and the user choses which ones are the real interfaces with a series of yes / no answers. That is, the user takes full repsonsibility for each and every boundary, ManSeg takes no responsibility for segmenting images - hence the name being derived from "The Manual Segmneter". ManSeg does all the book keeping and spits out the statistics and has the capability to handle materials with up to 10 different phases.ManSeg reads and parses Zeiss, Thermo Fisher and Hitachi SEM images to automatically extract and calibrate the image pixel size.Video tutorial is here: <a href="https://vimeo.com/393781421.The">https://vimeo.com/393781421.The</a> foundation of ManSeg was established in the RELHY project (<a href="https://cordis.europa.eu/project/id/213009">https://cordis.europa.eu/project/id/213009</a>) funded by the FP7-ENERGY - Specific Programme "Cooperation": Energy under the topic of ENERGY-2007-1.2-01 - New materials and processes for advanced electrolysers.</p>Jacob Bowenhttps://www.mathworks.com/matlabcentral/profile/14909-jacob-bowen662722019-12-29T11:48:50Z2019-12-29T11:48:50ZMittag-Leffler function with matrix argumentsEvaluate the Mittag-Leffler function with one or two parameters at square matrix arguments<p>This MATLAB functions evaluates the Mittag-Leffler (ML) function with two parameters ALPHA and BETA at the square matrix argument AE = ML(A,ALPHA,BETA) evaluates the ML function with two parameters ALPHA and BETA at the square matrix A argument; ALPHA must be any real and positive scalar, BETA any real scalar and A any real or complex square matrix. E = ML(A,ALPHA) evaluates the ML function with one parameter ALPHA at the square matrix A argument; ALPHA must be any real and positive scalar and A any real or complex square matrix.REFERENCES[1] R. Garrappa and M. Popolizio, Computing the matrix Mittag–Leffler function with applications to fractional calculus, Journal of Scientific Computing, 2018, 17(1), 129-153 - doi: <a href="https://doi.org/10.1007/s10915-018-0699-5[2]">https://doi.org/10.1007/s10915-018-0699-5[2]</a> R. Garrappa, Numerical Evaluation of two and three parameter Mittag-Leffler functions, SIAM Journal of Numerical Analysis, 2015, 53(3), 1350-1369.</p>Roberto Garrappahttps://www.mathworks.com/matlabcentral/profile/2361481-roberto-garrappa645782020-04-06T08:58:21Z2020-04-06T08:58:21Znistdata(species,T,p)Create tables of thermophysical properties for gases<p>Downloads data tables from the NIST Chemistry Webbook (<a href="http://webbook.nist.gov/chemistry/fluid/">http://webbook.nist.gov/chemistry/fluid/</a>) for a specified temperature and/or pressure range. The tables are useful for plotting or for data lookup by interpolation.</p>Are Mjaavattenhttps://www.mathworks.com/matlabcentral/profile/3934907-are-mjaavatten757582020-05-22T02:25:28Z2020-05-22T02:25:28ZInpaint NaN using GriddataInpaint: Substitute a matrix that has some nan values with interpolated values. <p>This algorithm is inspired by the work of John D'Erricohttps://<a href="http://www.mathworks.com/matlabcentral/fileexchange/4551-inpaint_nansHowever">www.mathworks.com/matlabcentral/fileexchange/4551-inpaint_nansHowever</a>, I do notice that the inpaint_nans algorithm given by John D'Ericco gives a higher gradient compared to griddata. So, this algorithm provides an alternative solution that some people may find it helpful. </p>Kin Sung Chanhttps://www.mathworks.com/matlabcentral/profile/7763866-kin-sung-chan738462020-01-06T04:56:47Z2020-01-06T04:56:47ZBasis PursuitBasis Pursuit (BP) Recovery Method for compressive sensing <p>Hi. Here is a Matlab function for Basis Pursuit Recovery Method in compressive Sensing.good luck </p>MohammadReza Jabbarihttps://www.mathworks.com/matlabcentral/profile/14310499-mohammadreza-jabbari724242019-08-13T12:52:21Z2019-08-13T12:52:21ZviolinViolin plot<p>Simple violin plot function using 'fitdist' and 'patch' function.Options to make 1-sided violins, rotate the violin horizontally and add a line for the median.</p>Jasper Fabiushttps://www.mathworks.com/matlabcentral/profile/15949961-jasper-fabius