https://se.mathworks.com/matlabcentral/answers/questions.atomMATLAB Answers — New Questions2017-07-20T18:50:07Ztag:se.mathworks.com,2005:Question/3490992017-07-17T15:41:19Z2017-07-20T18:50:07ZHow to reproduce Application Compiler with mcc?<p>I have used both the Application Compiler and mcc to make a standalone exe executable from a mfile. However the Application Compiler makes additional files and directories that mcc does not. I would like to set up mcc to run exactly like the default implementation of Application Compiler. Is there a flag or other straightforward way to do this?</p><p>Here is the mcc call I am using,</p><pre class="language-matlab">mcc -e myMfile.m -a splashScreen.tif -a someLibrary.dll -a someOtherLibrary.dll
</pre><p>which only creates one myMfile.exe in the same directory. However the Application Compiler creates a project subdirectory with further subdirectories (for_redistribution, for_redistribution_files_only, for_testing) populated with files.</p><p>If there is no straightforward solution, I will stick with Application Compiler.</p>KAEhttps://se.mathworks.com/matlabcentral/profile/authors/9495793-kaetag:se.mathworks.com,2005:Question/3496222017-07-20T17:35:08Z2017-07-20T18:49:41ZCan I draw all these separate contour planes in a single 3-D space ?<p>This image shows the pressure contours around an ellipsoid along X-Y, Y-Z, and X-Z planes separately.
I have used MATLAB to plot these diagrams. I want to show all these planes in a single 3-D plot of an ellipsoid. Can it be done using MATLAB?</p><img src = "/matlabcentral/answers/uploaded_files/83407/3-d%20plot.jpg"><pre> % 3D meshgrid in clast's coordinate
xgv = 0; % grid vector: x'axis,a1
ygv = -8:0.1:8; % grid vector: y'axis,a2
zgv = -6:0.1:6; % grid vector: z'axis,a3
[X,Y,Z] = meshgrid(xgv,ygv,zgv);</pre><pre> % Exterior points
ind = (X./1).^2 + (Y./a(2)).^2 + (Z./a(3)).^2 > 1;
x_ex = X(ind);
y_ex = Y(ind);
z_ex = Z(ind);
ep = cat(1,x_ex',y_ex',z_ex');
% total points number
num = numel(X);
% exterior points number
[~,n] = size(ep);</pre><pre> % Exterior Fields
%
G = Ex_Gtensor(a,ep); % this is some function to calculate pressure at
external points
Here I use some algorithm to calculate pressure field outside ellipsoid.
%--------------------------------------------------
pressure = zeros(num,1);
pressure(~ind) = p1;
pressure(ind) = p2;
% So this pressure variable has all the pressure values for all external points
pressure = reshape(pressure,size(squeeze(Z)));</pre><pre> contourf(squeeze(Y),squeeze(Z),pressure)
hold on
axis equal
% Similarly I use this code for X-Y and X-Z plane.</pre>Ankit Bhandarihttps://se.mathworks.com/matlabcentral/profile/authors/9064541-ankit-bhandaritag:se.mathworks.com,2005:Question/3496212017-07-20T17:28:51Z2017-07-20T18:48:13ZWhy the R G B component of a pic are not red green and blue?<p>HI,
I am new with the image processing and need to do some processing on the R G B component of a color pic.
I used the "image()" to show the R G B pic and it looks a little wired.
The code and the result are as below:
The first,second, and third pic corresponding to the R G B component of a pic of fourth pic.
My question is why the R G B component of a pic are not red, green, and blue?</p><img src = "/matlabcentral/answers/uploaded_files/83406/whyisnotrgb.JPG"><p>Any hint is appreciated.</p>sean songhttps://se.mathworks.com/matlabcentral/profile/authors/10586584-sean-songtag:se.mathworks.com,2005:Question/3493812017-07-19T10:22:27Z2017-07-20T18:46:31ZDouble Integral with interpolateSolution() from PDE solver in MATLAB<p>I have results from the PDE solver in MATLAB and I need to a double integral, I would assume by using the integral2() function.</p><p>The problem is I cannot form an input that is acceptable by the integral2 function, directly that is. I have tried using an anonymous function like this</p><pre class="language-matlab">f = @(x,y) interpolateSolution(result, x, y)
</pre><p>And this works perfectly but when I do integration on it.</p><pre class="language-matlab">integral2(f, 0, 5, 0, 8)
</pre><p>I get an error like this</p><pre class="language-matlab">Error using integral2Calc>integral2t/tensor (line 241)
Integrand output size does not match the input size.
</pre><p>I do not understand why I can't do this. I've been able to perform a fit using the toolbox and get a fit for the solution for which then I can create an anonymous function and perform integration. It works when using the fit, but not when I use the interpolateSolution() function. I would settle for the fit, but it takes too much time to solve the PDE, fit it, and perform integration and I'm trying to do an optimization study. Is there a better way to do integration on the results directly from PDE solver?</p>gbshhttps://se.mathworks.com/matlabcentral/profile/authors/6650112-gbshtag:se.mathworks.com,2005:Question/3491112017-07-17T16:58:39Z2017-07-20T18:45:58ZHow can I create a min step for ode45?<p>I have a problem with ode45. I have measured data and I don't want ode45 to create steps smaller than the sample time of the experiment, so that every time step of ode45 belongs to a measured value.</p>Pablo Gonzaleshttps://se.mathworks.com/matlabcentral/profile/authors/10328147-pablo-gonzalestag:se.mathworks.com,2005:Question/3496332017-07-20T18:45:54Z2017-07-20T18:45:54ZHow to fix a get sort row error?<p>I run a matlab based application with out any problem on my computer.
But when I run the same app on a colleague's computer, I get this error:
Jul 20, 2017 2:37:01 PM com.microsoft.sqlserver.jdbc.AuthenticationJNI <a href = "clinit">clinit</a></p><p>WARNING: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path</p><p>Undefined function 'sort' for input arguments of type 'MException'.</p><p>Error in sortrows>sort_back_to_front (line 114)
[~,ind] = sort(x(ndx,k),'ascend');</p><p>Error in sortrows (line 89)
ndx = sort_back_to_front(x_sub, col);</p><p>Why?
Thanks in advance for any help.</p>JFzhttps://se.mathworks.com/matlabcentral/profile/authors/6201072-jfztag:se.mathworks.com,2005:Question/3496322017-07-20T18:45:50Z2017-07-20T18:45:50ZHow can i display data from arduino uno in matlab?<p>I have made a Bluetooth controlled robot using Arduino uno and wish to display the velocity and the distance covered by the vehicle in matlab. I have included the Arduino files in the matlab library. How am I supposed to display the mentioned data(velocity,distance) in matlab interface?</p>Tanushree Guptahttps://se.mathworks.com/matlabcentral/profile/authors/10614341-tanushree-guptatag:se.mathworks.com,2005:Question/3496312017-07-20T18:45:46Z2017-07-20T18:45:46ZHow can I get the example code for "Hydraulic Axial-Piston Pump with Load-Sensing and Pressure-Limiting Control" to run?<p>I found an example for " <a href = "https://www.mathworks.com/help/physmod/hydro/examples/hydraulic-axial-piston-pump-with-load-sensing-and-pressure-limiting-control.html#zmw57dd0e2382">Hydraulic Axial-Piston Pump with Load-Sensing and Pressure-Limiting Control</a> " at the url pasted below but the example is not found when "sh_pump_axial_piston_control_load_pressure" is entered in the Matlab Command Window as directed in the Try it in Matlab link. Can you help me find the code for this example?</p><p>https://www.mathworks.com/help/physmod/hydro/examples/hydraulic-axial-piston-pump-with-load-sensing-and-pressure-limiting-control.html#zmw57dd0e2382</p>Rodneyhttps://se.mathworks.com/matlabcentral/profile/authors/3943416-rodneytag:se.mathworks.com,2005:Question/3496292017-07-20T18:33:27Z2017-07-20T18:44:05ZRemoving an empty folder and subfolder?<p>I have a code that searches through multiple subfolders and deletes all files with a .EIA extension. I want to know if there is any way I can search through the same subfolders and remove the ones that no longer have any files in them.</p><img src = "/matlabcentral/answers/uploaded_files/83415/Empty_Files.PNG">Joey Cavalehttps://se.mathworks.com/matlabcentral/profile/authors/7074118-joey-cavaletag:se.mathworks.com,2005:Question/3495582017-07-20T10:19:30Z2017-07-20T18:41:35ZSelecting one array out of three.<p>I have three arrays, including
A=[1 2 3 4 5 6 7 8 9 0 3 4 5 6];
B=[4 5 6 7 8 6 7 8 9 1 3 4 5 0];
C=[5 6 7 8 9 0 0 9 5 5 5 5 6 7]; Now I need to store one array in D i.e., D= any of one from three. Kindly help me out.</p>shane watsonhttps://se.mathworks.com/matlabcentral/profile/authors/9452398-shane-watsontag:se.mathworks.com,2005:Question/3491962017-07-18T07:19:29Z2017-07-20T18:40:16ZHow to sum up large values with high precision?<p>Hello all together,</p><p>I would like to calculate a formula which consists of the alternating (positive/negative) summation of very large values. For small values of N (for example N=3) ist works well. Also for larger values of N, if the gaps between the "Mueh" values are large enough. For the planned application of the formula, however, the values must be quite close together and N should nevertheless be able to reach at least values of 20 or 30. Here´s my current version using symbolic functions and vpa:</p><pre class="language-matlab">% Definition of values
N=11;
Mueh=[0.83 0.84 0.85 0.86 0.87 0.89 0.90 0.91 0.92 0.93 0.94];
Muehc=num2cell(Mueh);
T=25;
</pre><pre class="language-matlab">% Creating symbolic variables
syms C zaehler nenner CfF MfF;
mueh=sym('m',[1,N]);
syms t;
</pre><pre class="language-matlab">% Symbolic computing of the C-Values
for k=1:1:N
C(1,k)=1;
end
for i=2:1:N
for k=1:1:N
zaehler=1;
nenner=1;
for j=0:1:(i-2)
zaehler=vpa((zaehler*mueh(N-j)),50);
end
for l=0:1:(i-1)
if (l~=(k-1))
nenner=vpa((nenner*(mueh(N-l)-mueh(N-k+1))),50);
end
end
C(i,k)=vpa((zaehler/nenner),50);
end
end
</pre><pre class="language-matlab">% Symbolic computing of the function (here only for n=1)
for n=1:1:1
</pre><pre> for j=1:1:N-n+1
CfF(n,j)=vpa(C((N+1-n),j),50);
end</pre><pre> for l=1:1:N-n+1
MfF(n,l)= vpa(mueh(N-l+1),50);
end</pre><pre> f(t,mueh)=sum(vpa((vpa(CfF(n,:),50)) .* vpa(exp(-vpa(MfF(n,:),50)*t),50),50))
h(t)=f(t,Muehc{:})
end</pre><pre class="language-matlab">% Plot h
</pre><pre class="language-matlab">fplot(h, [0 5]);
</pre><p>The current result - although using sym and vpa looks like this:</p><img src = "/matlabcentral/answers/uploaded_files/83179/untitled.jpg"><p>I also tryed XSum without success.</p><p>Do you have an idea how to fix it?</p><p>Many thanks and best regards,
Johannes</p>Johannes Uhlhttps://se.mathworks.com/matlabcentral/profile/authors/3189549-johannes-uhltag:se.mathworks.com,2005:Question/3496302017-07-20T18:38:57Z2017-07-20T18:38:57ZI have an audio data set in terms of frequency(Y axis) vs frame (X axis) and want to detect values above a threshold that also stays beyond the value for more than a particular interval of frames and repeat using a loop. Can someone help me with it?<p>Frequency vs frame graph for 10 trials
cross function to find point above trials?
then also see if the value lies greater than the threshold for certain # of frames
Looping for 10 set of 10 trials</p>Niveditha Muthukrishnanhttps://se.mathworks.com/matlabcentral/profile/authors/8844205-niveditha-muthukrishnantag:se.mathworks.com,2005:Question/3496192017-07-20T16:19:05Z2017-07-20T18:37:04ZCPU is very high<p>Hello</p><p>I have started using MATLAB on this computer 1 year ago. However, I've stopped using it for a while and now that I come back to it, the CPU on my computer is running at 100% because of MATLAB.
I have tried the link,
com.mathworks.mlwidgets.html.HtmlComponentFactory.setDefaultType('HTMLRENDERER');
but it doesn't help. I currently am running MATLAB version 2016B student version.</p><p>Could anyone help me?
Thanks</p>yySBUhttps://se.mathworks.com/matlabcentral/profile/authors/7586990-yysbutag:se.mathworks.com,2005:Question/3484412017-07-12T17:43:27Z2017-07-20T18:37:03ZROC Curve for Multiclass RCNN<p>I have created a multiclass RCNN via the trainRCNNObjectDetector function and have created a results structure of a validation set of data, which is made up of 3 fields: Bounding Boxes, Scores and Labels, with their being two potential labels.</p><p>In reading the plotroc and perfcurve documentation, I haven't been able to find any method for obtaining performance or ROC curves for this multiclass problem. Is there any current methodology to attack this?</p>Timothy Kainhttps://se.mathworks.com/matlabcentral/profile/authors/7005278-timothy-kaintag:se.mathworks.com,2005:Question/3496262017-07-20T18:06:57Z2017-07-20T18:35:33ZIs it possible to automate a GUI and save the output in a spreadsheet?<p>I currently have a GUI that takes video files, allows a user to select a region of interest, and saves that as a .mat file. It gives an output of a few variables, a graph, and model fitting the data. Is there a way that I can load multiple .mat files at once, have the gui select the plot button, and save the parameters in a spreadsheet? I have hundreds of regions of interest that would take a very long time to run through again. It would also be helpful to save the graphs if that would be possible.</p>Nikhttps://se.mathworks.com/matlabcentral/profile/authors/6810385-niktag:se.mathworks.com,2005:Question/3496182017-07-20T16:15:44Z2017-07-20T18:31:59ZI want to convert the Julian date 273.791667 to calendar day and time<p>I want to convert the Julian date 273.791667 to calandar day and time</p>Thishan Dharshana Karandana Gamalathgehttps://se.mathworks.com/matlabcentral/profile/authors/2762250-thishan-dharshana-karandana-gamalathgetag:se.mathworks.com,2005:Question/3496282017-07-20T18:23:03Z2017-07-20T18:30:34ZHow to label different lines in a loglog plot<p>I have a bunch of different loglog plots of different power spectral density functions on the same graph (using hold on function) and I am trying to add labels to be able to differentiate the different lines. Does anyone know how to do this?
I have many different loglog(psd(A)) for example, and would like to have a legend to be able to tell which color corresponds to which letter (ie blue line is A). New to matlab so would appreciate any help! Thanks!</p>Cameron Parkhttps://se.mathworks.com/matlabcentral/profile/authors/10529449-cameron-parktag:se.mathworks.com,2005:Question/3495732017-07-20T11:21:52Z2017-07-20T18:29:02ZNot enough input arguments.<p>Hi I want to use this function :</p><pre class="language-matlab">function f = GA_fitnessfcn(x)
Kp = x(1);
Rp = x(2);
T2 = x(3);
T3 = x(4);
T4 = x(5);
T5 = x(6);
H2 = x(7);
%%% Run Simulation
simoption = simset('Solver','ode23tb','SrcWorkspace','Current');
sim('power_thermal_ga.mdl',[0 0.25],simoption);
f = H(end);
</pre><p>But I get this error :</p><pre class="language-matlab">Error using GA_fitnessfcn (line 3)
Not enough input arguments.
</pre><p>how can i fix it?</p>amidhttps://se.mathworks.com/matlabcentral/profile/authors/4847740-amidtag:se.mathworks.com,2005:Question/3423272017-05-29T06:25:39Z2017-07-20T18:24:22ZHow to add a regression layer at the end of an existing CNN?<p>Hi</p><p>I have been trying to use transfer learning with a regression layer at the end. However, I end up with NaNs when I try to predict new images with the ConvNet. How should I put together the layers at the end? Like this?</p><pre class="language-matlab">% Load VGG network
net = vgg19;
</pre><pre class="language-matlab">% Remove last 3 layers.
layersTransfer = net.Layers(1:end-3);
</pre><pre class="language-matlab">% Add a fully connected layer and a regression layer
layers = [layersTransfer
fullyConnectedLayer(1)
regressionLayer];
</pre><pre class="language-matlab">% Training options
transferLayerOptions = trainingOptions('sgdm','MiniBatchSize',25,...
'InitialLearnRate',0.001, ...
'MaxEpochs',7, 'Verbose', true);
</pre>Tobias Pahlberghttps://se.mathworks.com/matlabcentral/profile/authors/3011825-tobias-pahlbergtag:se.mathworks.com,2005:Question/3480562017-07-10T15:34:03Z2017-07-20T18:21:20ZHow to use QGIS geotiff in matlab?<p>Hi All,</p><p>For starters, I am using R2017a on a Mac.</p><p>I am using ship sounding bathymetry (water depth) data in QGIS to produce maps in GeoTiff format. QGIS produces a .tiff and .tfw (world file). What I am trying to do is use these maps from QGIS in Matlab, and calculate the difference between the ship sounding data and other bathymetry data (i.e GEBCO, ETOPO)</p><p>I have tried using geotiffread to read in the geotiff file but receive the error:</p><p>Error using geotiffinfo>readinfo (line 259) The file 'Bathymetry_test.tiff' does not contain any GeoTIFF Tags. Use the function IMFINFO to obtain information about the file.</p><p>My .tiff file does not seem to have associated coordinates, however, I am able to import the worldfile using the worldfileread function.</p><p>My question is: How can I assign coordinates from the .tfw worldfile to my .tiff file?</p>Anna Haydenhttps://se.mathworks.com/matlabcentral/profile/authors/6918139-anna-haydentag:se.mathworks.com,2005:Question/3454262017-06-20T02:12:39Z2017-07-20T18:20:24ZHow to implement Faster R CNN object detector?<p>I am using</p><pre class="language-matlab">trainFasterRCNNObjectDetector
</pre><p>for the detection task. My ROIs in an image has single size((96*96*3) in (684*912) image size.) Although my object sizes very in a 96*96*3 image patch, I train my CNN such that it classifies the objects at the centres only.</p><p>In such a scenario, I want the anchors in RPN such that it detects foreground even for the smallest object at the centre(let's say objects with 60 diameters) so that it could be the part of the classification (It actually helps when two objects are overlapping each other, and one of them is slight off-center, I believe).</p><p>In such case I need might need three different anchorBox sizes(let's say 60,80,96). For such case how to decide</p><pre class="language-matlab">'BoxPyramidScale' — Anchor box pyramid scale
</pre><p>and</p><pre class="language-matlab">'NumBoxPyramidLevels' — Number of anchor box pyramid levels
</pre><p>I am quite confused in this two arguments. Thanks.</p>Jayhttps://se.mathworks.com/matlabcentral/profile/authors/6715736-jaytag:se.mathworks.com,2005:Question/3491582017-07-17T23:26:25Z2017-07-20T18:18:04Z[Eyetracker] How can I extract specific lines of text data with multiple headers<p>Hello,</p><p>I have a text file which is in this format :</p><pre class="language-matlab">Table Header for Fixations:
Event Type Trial Number Start End Duration Location X Location Y Dispersion X Dispersion Y Plane Avg. Pupil Size X Avg. Pupil Size Y
</pre><pre class="language-matlab">Table Header for Saccades:
Event Type Trial Number Start End Duration Start Loc.X Start Loc.Y End Loc.X End Loc.Y Amplitude Peak Speed Peak Speed At Average Speed Peak Accel. Peak Decel. Average Accel.
</pre><pre class="language-matlab">Table Header for Blinks:
Event Type Trial Number Start End Duration
</pre><pre class="language-matlab">Table Header for User Events:
Event Type Trial Number Start Description
</pre><pre class="language-matlab">Table Header for Trigger Line Events:
Event Type Trial Number Start Duration Port Status
</pre><pre class="language-matlab">TriggerLine 1 1 632707887 17402790 120
TriggerLine 1 2 650127313 22044803 120
TriggerLine 1 3 672188819 373945665 120
TriggerLine 1 4 1046151042 58214740 120
TriggerLine 1 5 1104382361 325613598 120
TriggerLine 1 6 1430012651 24057981 120
TriggerLine 1 7 1454087118 192346927 120
TriggerLine 1 8 1646450655 13027109 120
TriggerLine 1 9 1659511020 320755270 120
TriggerLine 1 10 1980283097 149920874 120
Fixation B 1 1 623756870 624388984 632114 451.56 294.47 2 8 -1 87.16 75.92
Blink B 1 1 624388984 624621974 232990
Fixation B 1 2 624621974 625553703 931729 578.77 312.47 5 15 -1 90.41 78.13
Blink B 1 2 625553703 625819981 266278
Fixation B 1 3 625819981 626485566 665585 567.75 305.17 5 6 -1 94.03 80.65
Saccade B 1 1 626485566 626535288 49722 566.27 306.11 454.79 309.45 4.96 260.04 0.67 140.33 9071.39 410.15 5348.79
Fixation B 1 4 626535288 627683395 1148107 435.34 305.19 21 11 -1 96.94 82.01
Blink B 1 3 627683395 628232281 548886
Fixation B 1 5 628232281 628731643 499362 458.17 292.09 3 5 -1 101.20 85.20
Saccade B 1 2 628731643 628764768 33125 455.68 292.43 446.05 294.35 0.54 36.53 0.50 19.82 2024.70 1.80 1013.25
Fixation B 1 6 628764768 629779743 1014975 426.41 304.12 6 7 -1 101.57 85.30
Blink B 1 4 629779743 646500490 16720747
Fixation B 1 7 646500490 646966141 465651 519.89 274.86 16 44 -1 90.11 69.54
Saccade B 1 3 646966141 647016189 50048 517.23 263.95 545.84 273.14 1.87 80.40 0.67 38.92 3058.65 586.94 1890.55
Fixation B 1 8 647016189 647415411 399222 549.07 279.40 6 4 -1 88.42 79.42
Saccade B 1 4 647415411 647448660 33249 547.67 281.06 559.92 280.36 0.84 45.32 0.50 26.62 2250.69 495.81 1373.25
Fixation B 1 9 647448660 648047684 599024 562.61 282.73 4 7 -1 88.56 79.50
Blink B 1 5 648047684 648347193 299509
Fixation B 1 10 648347193 648929475 582282 387.15 283.03 4 6 -1 91.51 79.60
Saccade B 1 5 648929475 648979394 49919 386.72 285.17 328.18 271.67 2.98 116.87 0.67 74.50 6179.34 228.32 2462.09
Fixation B 1 11 648979394 649378721 399327 326.44 269.82 5 4 -1 89.08 79.46
Saccade B 1 6 649378721 649412104 33383 329.41 269.51 336.87 269.52 0.52 27.20 0.50 16.46 1698.78 406.03 1052.41
Fixation B 1 12 649412104 649961159 549055 345.87 272.08 4 3 -1 91.73 80.39
</pre><p>And my goal would be to extract events of the same types in separate arrays with the respective headers. Do you guys have any idea how I should proceed ?</p><p>Thanks a lot, and sorry for asking such a vague question.</p>Maxmax95https://se.mathworks.com/matlabcentral/profile/authors/9228429-maxmax95tag:se.mathworks.com,2005:Question/3491512017-07-17T21:50:57Z2017-07-20T18:16:13ZCursor location found much faster in mfile than in compiled exe. How to fix?<p>I have a mfile which finds the location of the user's cursor in an axis, and each identified location is the basis for calculations. The results are displayed quickly, seemingly concurrent with the cursor motion. When I run an exe executable compiled from the same mfile, however, results are displayed slowly, as if the exe is struggling to keep up with the cursor's motion unless I move it very slowly. I am running R2015b and compiling with the Application Compiler tool, and the mfile is part of a GUI. Are there any known issues that might be slowing the exe?</p>KAEhttps://se.mathworks.com/matlabcentral/profile/authors/9495793-kaetag:se.mathworks.com,2005:Question/3087482016-10-23T20:22:34Z2017-07-20T18:15:45ZDifferent colors for different ranges of data<pre class="language-matlab">figure
latlim = [-15 15];
longlim = [90 125];
worldmap(latlim, longlim)
load coast
geoshow(lat, long)
</pre><pre class="language-matlab">samplefactor = 1;
</pre><pre class="language-matlab">[Z, refvec] = etopo('etopo1_bed_c_i2.bin',samplefactor,latlim,longlim);
geoshow(Z, refvec, 'DisplayType', 'texturemap');
demcmap(Z, 256);
geoshow('landareas.shp', 'FaceColor', 'none', ...
'EdgeColor', 'black');
</pre><pre class="language-matlab">load Sumatra_catalog.txt
</pre><pre> plotm(Sumatra_catalog(:,1),Sumatra_catalog(:,2),'k.')
%depth = (Sumatra_catalog(:,3))</pre><p>What this code does is loads a text file containing earthquake latitude, longitude and depth data. It plots the data onto a coastline as block dots.. What I want to do, is change the colour of the dots based on the different depths. For example, black for depths of 0-100, red for depths of 101-200, blue for 201-300 and so forth.</p><p>I was thinking of using a for loop with else/if statements, I've had a look at the documentation but I'm not sure how how to implement.</p><p>Any help appreciated.</p>JDillahttps://se.mathworks.com/matlabcentral/profile/authors/6270382-jdillatag:se.mathworks.com,2005:Question/3496272017-07-20T18:14:52Z2017-07-20T18:18:37ZAdding a scatter plot on top of a box plot<p>Hi,</p><p>I have plotted box plots for 3 samples, now I want to also add a single y-axis value corresponding to each of the 3 xticklabels, while still keeping the box plots. I know I should use hold on, but I don't know how to proceed further. The script is below:</p><pre> load('s.mat')
b = boxplot(unnamed*100);
set(b(7,:),'Visible','off') %removes the outliers
hold on
ylabel('Grade (%)');
xticklabels({'S1','S2','S3'});
hold on</pre><p>now I want to show values of 90, 80, and 70 for samples S1, S2, and S3 while still keeping the box plots</p><p>Thanks,</p><p>Rosie</p>Rosiehttps://se.mathworks.com/matlabcentral/profile/authors/9641654-rosietag:se.mathworks.com,2005:Question/3481682017-07-11T07:27:26Z2017-07-20T18:11:55Zhow can i get china'Polygon Geographic Vector Data<p>I want to print china Geographic map,where can i get china's Polygon Geographic Vector Data? as is shown , <a href = "https://cn.mathworks.com/help/map/examples/creating-map-displays-with-latitude-and-longitude-data.html">https://cn.mathworks.com/help/map/examples/creating-map-displays-with-latitude-and-longitude-data.html</a>,Geographic vector data can be stored in a variety of different formats including standard file formats such as shapefiles, GPS Exchange (GPX), NetCDF, HDF4, or HDF5 and specific vector data products such as Vector Smart Map Level 0 (VMAP0), and the Global Self-Consistent Hierarchical High-Resolution Geography (GSHHG).</p>Vinmin Caohttps://se.mathworks.com/matlabcentral/profile/authors/8506246-vinmin-caotag:se.mathworks.com,2005:Question/3496252017-07-20T18:03:07Z2017-07-20T18:10:00Zylabels on the yyplot command<p>On the yyplot how can I get ylabels on both y axis?</p>William Boberhttps://se.mathworks.com/matlabcentral/profile/authors/889829-william-bobertag:se.mathworks.com,2005:Question/3496232017-07-20T17:41:34Z2017-07-20T18:09:37ZPlotting a summation as a function of two variables<p>Hello, Sorry I'm new to matlab and I couldn't work out the solution to this question with the help.</p><p>I'm plotting a function of \theta and \phi as a density plot over the surface of the sphere.</p><p>For an easy function f, I had luck using the following code:</p><pre class="language-matlab">res = 50;
lambda = linspace(-pi,pi,res);
theta = linspace(-pi/2,pi/2,ceil(res/2));
[L,T] = meshgrid(lambda,theta);
n=10;
f=(n.*(cos((T-pi/2)/2)).^2+1).*exp(-n.*(sin((T-pi/2)/2).^2));
[X,Y,Z] = sph2cart(L,T,1);
clf;
surf(X,Y,Z,f);
</pre><p>Now I'm trying to do the same but with a more difficult function you can see here</p><img src = "/matlabcentral/answers/uploaded_files/83408/formula.png"><p>with \mu \nu numbers... We can use a simpler function as a minimal example, like</p><p>\sum_{S=0}^{1000} (2S+1) (cos(\theta/2))^2</p><p>How can I do to represent this function (of \theta and \phi)over the sphere just like I did with the example below?</p><p>Many Thanks</p>Pablohttps://se.mathworks.com/matlabcentral/profile/authors/4167732-pablotag:se.mathworks.com,2005:Question/3490842017-07-17T14:03:14Z2017-07-20T18:08:14ZHow can I apply my faster RCNN Object Detector on the example "Tracking Pedestrians from a Moving Car"<p>I trained my faster RCNN Object Detector. I want to apply my detector on a video.
So, I found a good example in Matlab. It's the Tracking Pedestrians from a Moving Car Example.
I tried to change the ACF detector to the faster RCNN detector in the example.
But It couldn't work.
Please let me know how to apply the faster RCNN detector on the example.
Thank you!</p><pre> % Create system objects used for reading video, loading prerequisite data file, detecting pedestrians, and displaying the results.
videoFile = 'vippedtracking.mp4';
scaleDataFile = 'pedScaleTable.mat'; % An auxiliary file that helps to determine the size of a pedestrian at different pixel locations.
obj = setupSystemObjects(videoFile, scaleDataFile);
detector = peopleDetectorACF('caltech');</pre>Jungmoon Kimhttps://se.mathworks.com/matlabcentral/profile/authors/8425450-jungmoon-kimtag:se.mathworks.com,2005:Question/3496172017-07-20T16:08:11Z2017-07-20T18:06:32ZIs is that you can only add no more than two linear constraints when using fmincon for optimization<p>Is is possible to add more than two nonlinear constraints? Cuz when writing the nonlinear constraints the "c" seems only take no more than two expressions. Would appreciate a lot if you can give some ideas on this!</p>Cross Yehttps://se.mathworks.com/matlabcentral/profile/authors/6456786-cross-yetag:se.mathworks.com,2005:Question/3491212017-07-17T17:55:48Z2017-07-20T18:04:15ZHow I can implement OQPSK Transmitter and Receiver basing on QPSK Transmitter and Receiver example ?<p>I want to implement a new version of QPSK Transmitter and Receiver with OQPSK modulation in Simulink.</p><p>This is the example of QPSK:
https://www.mathworks.com/help/comm/examples/qpsk-transmitter-and-receiver-1.html</p><p>I tried to change the Modulator and Demodulator, but once the OQPSK have a 1/2 Tb delay in quadrature, the output don't get what is expected.</p><p>If anyone could help me. Thanks</p>Diogo Justohttps://se.mathworks.com/matlabcentral/profile/authors/6240866-diogo-justotag:se.mathworks.com,2005:Question/968002009-09-30T19:50:00Z2017-07-20T18:04:12ZHow do I find my Login Name in order to activate my license?<p>When I try to activate my license, it asks for my Login Name. How do I find this?</p>MathWorks Support Teamhttps://se.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:se.mathworks.com,2005:Question/3494662017-07-19T17:37:46Z2017-07-20T17:55:35ZHow to plot a Damped and driven oscillation<p>I try to compute a simple damped and driven oscillation but it just won't work out. Is there anybody who can help me? This is my code:</p><pre> q = [0:10];
q = q(:);
for(x=1:10)
q(x);
for(t=0:0.1:1)
q(x)= exp(-t)*(exp(2*t)-exp(-2*t));
end
end</pre><pre> plot(q)</pre>Lukas Goldschmiedhttps://se.mathworks.com/matlabcentral/profile/authors/9666310-lukas-goldschmiedtag:se.mathworks.com,2005:Question/3494682017-07-19T17:49:42Z2017-07-20T17:53:21Zhow to save data from a for loop in an array?<p>Within my program I intent to create a for loop for as follows and I want to save the data of x (an array with two elements [a b]) from each iteration. I have tried several approaches such as the cell one but I couldnt make it work. Also I want to create a graph between qe and x for all iterations saved.</p><pre class="language-matlab">for i=1:5
qe=qe+0.1;
x=linprog(f,A,b,Aeq,beq);
f=[qe qg];
end
</pre>Theonymfi Loizouhttps://se.mathworks.com/matlabcentral/profile/authors/10617471-theonymfi-loizoutag:se.mathworks.com,2005:Question/2157432015-05-08T15:41:52Z2017-07-20T17:51:17Zinsulin pump output, newbie here<p>Hello,
I am a new user, starting small here by trying to make an x/y plot with data from my insulin pump.
The software provides a .csv file, from there I would like to create a script within matlab to read the file, and plot the results in a graph.
There is a header in the file, and the parameter names start on line 11, this will/should stay constant.
What I'm wondering for starters is how to import the csv, and get the data into MATLAB.
I'd like to plot day by day, with timestamp column/BG reading.</p><p>Any helps/books or references are appreciated.
Thanks!</p><p>Sample file attached below</p>my8950https://se.mathworks.com/matlabcentral/profile/authors/2472083-my8950tag:se.mathworks.com,2005:Question/3493412017-07-19T05:54:17Z2017-07-20T17:43:48ZI want to find DCT of a gray scale image. How to do it?<p>The gray scale image is divided into 8*8 blocks. How to find DCT of EACH 8*8 block and display dct of one block? Further, how to quantize the dct of each block?</p>Chandvi Arorahttps://se.mathworks.com/matlabcentral/profile/authors/10589640-chandvi-aroratag:se.mathworks.com,2005:Question/3494902017-07-19T21:30:55Z2017-07-20T17:40:10Zplot lines from elements of a matrix, which gives us points. each point has its coordinates in a separate matrix. <p>Hello,</p><p>I have a connectivity array as:</p><pre class="language-matlab">[0 0 0 0 1 0 0 0 0;
0 0 0 2 6 10 0 0 0;
0 0 0 3 7 11 15 19 0 0 ;
0 4 8 12 16 20 24 28 0;
5 9 13 17 21 25 29 33 37;
0 14 18 22 26 30 34 38 0;
0 0 23 27 31 35 39 0 0 ;
0 0 0 32 36 40 0 0 0 ;
0 0 0 0 41 0 0 0 0 ]
</pre><p>i have a separate text file which i have uploaded with the coordinates of each node number int eh connectivity array.</p><p>i want to write a code such that i have lines joining points from each row...eg: from coonc table:</p><p>2, 6 10: forms a line
3, 7, 11 15, 19 forms a line and so on...</p><p>PS: the variables and nodes can be changed so i dont want to code anything specific to these points only. I hop i get some help!</p><p>Many thanks!!</p>SAKSHI SINHAhttps://se.mathworks.com/matlabcentral/profile/authors/6887232-sakshi-sinhatag:se.mathworks.com,2005:Question/3496042017-07-20T14:58:40Z2017-07-20T17:38:36ZPlotting Issues - my plot does not include all values<p>Hi,</p><p>I have generated the following code:</p><pre class="language-matlab">for input=true
Sun_Elevation=83; % degrees (fixed) %
end
for constants=true
EL=0.00835; % deg/s %
Yaw_magnitude=180; % degrees %
end
for computation=true
Sun_EL=90-Sun_Elevation; % Delta Sun Elevation %
Period=(2*Sun_EL/EL); % night period in seconds %
Period_min=Period/60; % night period in minutes %
Yaw=Yaw_magnitude/Period;
end
for rate=true
EL_rate=Sun_Elevation:EL:90;
EL_rate_f=[EL_rate flip(EL_rate)];
duration=0:length(EL_rate_f)-1;
S0=[Sun_Elevation 0];
R=[EL Yaw];
ln=floor(Period/2);
S(ln,2)=zeros;
for i=1:ln
for j=1:length(S0)
if i==1
S(i+1,j)=S(i,j)+S0(j)+R(j);
else
S(i+1,j)=S(i,j)+R(j);
end
end
end
S(1,1:2)=S0;
St=[S;flip(S)];
time=(1:length(St))';
Time_min=time/60;
end
for FWD_face=true
E=St(:,1); % Elevation %
T=St(:,2); % Tilt %
sA=sind(E);
cA=cosd(E);
sB=sind(T);
cB=cosd(T);
N=sA.^2+(sB.^2).*(cA.^2)-1-(cB.^2).*(cA.^2);
D=-2*cB.*cA;
I=acosd(N./D);
end
for LEAD_face=true
T_2=90-T; % Tilt %
sA_2=sind(E);
cA_2=cosd(E);
sB_2=sind(T_2);
cB_2=cosd(T_2);
N_2=sA_2.^2+(sB_2.^2).*(cA_2.^2)-1-(cB_2.^2).*(cA_2.^2);
D_2=-2*cB_2.*cA_2;
I_2=acosd(N_2./D_2);
I_2_real=real(I_2);
end
for display=true
input_main=['Sun Elevation to main PV panel = ' num2str(Sun_Elevation) ' degrees'];
disp(input_main);
p=['Shadow Period = ' num2str(Period_min) ' minutes'];
disp(p);
y=['Yaw Required = ' num2str(Yaw) ' deg/s'];
disp(y);
figure(1);
[hAx,hLine1,hLine2] = plotyy(Time_min,I,Time_min,I_2_real);
title('Front Face & Lead Face');
xlabel('Time (min)');
ylabel(hAx(1),'Angle of Incidence - Front face (deg)'); % left y-axis
ylabel(hAx(2),'Angle of Incidence - Lead face (deg)'); % right y-axis
legend('Front face','Lead face');
xlim([0 Period_min]);
grid on
grid minor
end
</pre><p>The code is supposed to plot Time_min vs I_2_real. However, even though both have the same size, the plot that appears tends not to include the last couple values for I_2_real. Can somebody explain that please and probably tell me what I am doing wrong. I have attached the plot for your attention.</p><p>Thank you in advance!</p><p>Yamen</p>Yamen Alsayed Omarhttps://se.mathworks.com/matlabcentral/profile/authors/9746344-yamen-alsayed-omartag:se.mathworks.com,2005:Question/3491392017-07-17T20:25:50Z2017-07-20T17:37:40ZImage Analysis on stars/streaks in sky<p>I'm working on a program that will find out the orientation and location of streaks in the sky are based on images taken from telescopes in order to update current skycatalogs on where orbital debris and satellites are. Currently I have determined what pixels in the image are part of a streak (bright white lines), and I have put the horizontal and vertical indices of these pixels in a 2-d array. In (example image), the left side is the pre-processed image and the right side I have replaced all the pixels in the streak with the average noise value of the image. Exampleimage2 shows another example input with an obvious streak.</p><p>My question is, how can I determine the width of the streak if I already have the horizontal and vertical indices of all the pixels in the streak (note: the width would be the shorter dimension, probably only a few pixels wide).</p>David Kittnerhttps://se.mathworks.com/matlabcentral/profile/authors/7015895-david-kittnertag:se.mathworks.com,2005:Question/3494982017-07-20T00:52:48Z2017-07-20T17:35:50ZCannot use sim command in genetic algorithm<p>For some reason I cannot seem to run the sim command to simulate a model which is required to estimate parameters in the model which the genetic algorithm will do. I pass the objective function to ga:</p><pre class="language-matlab">%% load measured data
load('data_R01_full','simVol_TECM','simTime_TECM','simSoC_TECM','simOCV_TECM');
cap=0;
R0=47e-3;
</pre><pre class="language-matlab">%% set bounds
lb=[0;47e-3]; %cap, R0
ub=[0.2;75e-3];
</pre><pre class="language-matlab">%% est fcn
estfcn=@(x) gafunc(x,simVol_TECM,simOCV_TECM,simSoC_TECM,simTime_TECM);
</pre><pre class="language-matlab">%% estimation
[xOpt,fVal] = ga(estfcn,2,[],[],[],[],lb,ub);A
</pre><p>And my objective function starts with this:</p><pre> function G = gafunc(x,Vbat_meas,OCV_meas,SoC_meas,t_meas)
open('gatest_ss_standalone');
run 'ga_standalone_tests';%loads all the variables necessary for simulation
cap_val=x(1);
R0=x(2);
[tout,~,output]=sim('gatest_ss_standalone',StopTime);
close('gatest_ss_standalone')</pre><p>It never simulates because I get an error saying some parameters are undefined in the model, even though I have specified it in the script 'ga_standalone_tests'. Anyone know why I get this error?</p>Imisi Johttps://se.mathworks.com/matlabcentral/profile/authors/8651443-imisi-jotag:se.mathworks.com,2005:Question/991332012-10-22T15:41:00Z2017-07-20T17:33:12ZWhy do I receive a "Compile error: Sub or Function not defined" error when calling Excel Link functions from an Excel VBA macro?<p>When calling any of the exported Excel Link functions (MLGetMatrix, MLPutVar, etc.) in an Excel VBA macro, I receive the following VBA error:</p><pre class="error"> </pre><pre> "Compile error: Sub or Function not defined"</pre>MathWorks Support Teamhttps://se.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:se.mathworks.com,2005:Question/3494782017-07-19T19:26:47Z2017-07-20T17:30:52Zanonymous function for if-else statements<p>Hi,
Is it possible to write an anonymous function or a function handle that replicates the behavior of if-else statements?</p><p>Consider the simple problem</p><pre class="language-matlab">if condition
a=b(x);
else
a=c(x);
end
</pre><p>it is possible to write the following function that will replicate that behavior</p><pre> function out=ifelse(condition,answer1,answer2)
if condition
out=answer1;
else
out=answer2;
end</pre><p>A critical difference between the first and the second pieces of code is the fact that in the second one, both answer1 and answer 2 need to be computed/evaluated before passing them to the ifelse function. For small problems this is not really a problem. However, in a situation where b(x) or c(x) are expensive to compute, it is best to avoid un-necessary operations.</p><p>One workaround would be</p><pre> function out=ifelse2(condition,input1,input2)
if condition
out=eval(input1);
else
out=eval(input2);
end</pre><p>In this case though we have to use "eval".</p><p>Is there any other way to deal with this, possibly using some kind of anonymous function or a function handle?</p><p>Thanks</p>Patrick Mbomahttps://se.mathworks.com/matlabcentral/profile/authors/1075584-patrick-mbomatag:se.mathworks.com,2005:Question/3494822017-07-19T19:52:42Z2017-07-20T17:28:22ZSingular problem for bvp4c<p>Hi All,</p><p>I encounter some singular problems regarding bvp4c, please see my code for my equations and implementation. I know that when x = -1 and 1, my derivative goes to infinity. And it seems like that MATLAB complaints about this. I wonder is there any workaround for this problem? I tried on ode113, and instead of evaluating my initial point at x = -1, I just do it at x = -1 + 1e-7 to avoid this singular points. And it is solvable. I would like to use bvp4c because I have other equations and boundary condition to coupled together. I wonder is there similar strategy for bvp4c?
Here are my code</p><pre class="language-matlab">solinit = bvpinit(linspace(-1,1,50),0);
sol = bvp4c(@height_ode,@height_bc,solinit);
y = deval(sol,linspace(-1,1,50));
plot(linspace(-1,1,50),y(1,:))
</pre><p>and defintion for height_ode and height_bc are following:</p><pre class="language-matlab">function dhdx = height_ode(x,h)
w = 0.7;
q = 1/2*w*(1-x^2);
dqdx = -w*x;
kappa = 1.469;
dhdx = (560*h(1)^0.5*q - 64*h(1).^4 + 6*w.^(7/8)*(72*kappa - 77)*h(1)*q*dqdx)/(3*w.^(7/8)*(96*kappa - 77)*q.^2);
end
</pre><pre class="language-matlab">function res = height_bc(yleft, yright)
res = [yleft];
</pre>Zhekai Denghttps://se.mathworks.com/matlabcentral/profile/authors/6375676-zhekai-dengtag:se.mathworks.com,2005:Question/3495532017-07-20T10:02:02Z2017-07-20T17:25:45ZNonlinear least-squares fitting of curve described by PDEs<p>Hi people. I would like to fit a curve described by a system of two 2nd degree partial differential equations (PDEs) using <tt>lsqnonlin</tt>. While it is simple to write your anonymous function when you have a single equation for your model, how can you do it when you have a system of PDEs, which do not have an analytic solution for the parameter of interest (the one to be fitted on the experimental data)? The PDEs have a number of free variables for which I would like to get the values that best fit the data. I could also try a better method than <tt>lsqnonlin</tt>, if there is one.
Thanks</p>Xenhttps://se.mathworks.com/matlabcentral/profile/authors/5358452-xentag:se.mathworks.com,2005:Question/2665152016-02-03T21:21:13Z2017-07-20T17:21:36ZCan't reload '/usr/local/matlab-res.2015b/bin/glnxa64/libmwosgserver.so'<p>I use "MatLab" in an old SUN workstation in Linux environment. It is too old to run "MatLab 2015b" and cant not be upgraded. So I use "ssh -XC" to connect to a new Linux server and run "Matlab 2015b". It works normally when I do computation or run a matlab script without plot. However, when I try to generate a figures, it shows error message as:</p><pre> Can't reload '/usr/local/matlab-res.2015b/bin/glnxa64/libmwosgserver.so'</pre><p>for example:</p><pre class="language-matlab">>> clear all;
>> x = linspace(0,2*pi,1001);
>> y = sin(x);
>> plot(x,y)
Error using gca
While setting the 'Parent' property of 'Axes':
Can't reload '/usr/local/matlab-res.2015b/bin/glnxa64/libmwosgserver.so'
</pre><pre class="language-matlab">Error in newplot (line 68)
ax = gca(fig);
</pre><p>I did check the file, "libmwosgserver.so" and it indeed in the fold. What is the problem and how to solve it?</p><p>Huang</p>Gwojong Huanghttps://se.mathworks.com/matlabcentral/profile/authors/7616074-gwojong-huangtag:se.mathworks.com,2005:Question/3494192017-07-19T13:11:04Z2017-07-20T16:39:50ZMatlab Engine for C - Passing Arrays<p>Hi,
I am trying to make a simple Matlab Engine app, and am running into difficulties working out how to pass arrays. The code is as follows....</p><pre class="language-matlab">#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "engine.h"
</pre><pre class="language-matlab">void myFun(double t2[], int arrayLen, char *funName);
</pre><pre class="language-matlab">void myFun(double t2[], int arrayLen, char *funName) {
static Engine *ep;
static double engStatus = 0;
mxArray *result = NULL;
double * sum;
mxArray *T = NULL;
</pre><pre class="language-matlab"> //char funName[50] = "debugMfile";
</pre><pre class="language-matlab"> if(engStatus == 0) {
ep = engOpen(""); // Connect to MATLAB engine
if(ep==0) {
printf("Connecton to Matlab Engine failed\n");
}
else {
printf("Connecton to Matlab Engine succeeded!\n");
engEvalString(ep,"cd('/home/arwel/Documents/MATLAB/mNestFiles');");
engStatus = 1;
}
}
</pre><pre class="language-matlab"> //Create variables for the inputs
T = mxCreateDoubleMatrix(1,arrayLen,mxREAL);
memcpy((void *)mxGetPr(T), (void *)t2, 4);
</pre><pre class="language-matlab"> //Put these variables in the Matlab workspace
engPutVariable(ep,"time",T);
</pre><pre class="language-matlab"> //Now call the function..
//(N.B. eventually aim to do this based on 'funName')
engEvalString(ep,"total = debugMfile(time)");
</pre><pre class="language-matlab"> //Get the return value..
result = engGetVariable(ep,"total");
sum = (double *)mxGetData(result);
</pre><pre class="language-matlab"> printf("The answer is %f \n",sum);
</pre><pre class="language-matlab"> engClose(ep);
</pre><pre class="language-matlab">}
</pre><pre class="language-matlab">int main() {
</pre><pre class="language-matlab"> double time[4] = {1, 2, 3, 4};
int arrayLen = 4;
char funName[50] = "debugMfile";
</pre><pre class="language-matlab"> myFun(time, arrayLen, funName);
</pre><pre class="language-matlab"> return(0);
</pre><pre class="language-matlab">}
</pre><p>..with a 'toy' Matlab test function that looks like this...</p><pre class="language-matlab">function total = debugMfile(time)
</pre><pre class="language-matlab">total = sum(time);
save debugMfileVars.mat
</pre><pre class="language-matlab">end
</pre><p>But, the result I get back into C is always 0.000, and if I examine 'debugMfileVars.mat' it's just...</p><pre class="language-matlab">>> a = load('debugMfileVars.mat')
</pre><pre class="language-matlab">a =
</pre><pre> struct with fields:</pre><pre> time: [0 0 0 0]
total: 0</pre><pre class="language-matlab">>>
</pre><p>Clearly I've missed a step or mixed up something with pointers here somewhere but can't spot it. What have I missed here??
Cheers,
Arwel</p>Arwelhttps://se.mathworks.com/matlabcentral/profile/authors/1788146-arweltag:se.mathworks.com,2005:Question/3496112017-07-20T15:45:55Z2017-07-20T16:39:06ZQuestion about columns and multiplying within new columns<p>I have a problem which is slightly complicated to explain but bear with me.
I recently was given data on the time and strain of a large number of particles(1500) but all the data is represented in two columns (One for time and one for strain). There are different numbers of data rows representing each particle (particle 1 may have 150 rows of data while particle 2 may have 231 rows of data). Each particle has a break of roughly 3 rows that appears as 'NaN' ( I managed to convert the NaN to zero with '(isnan(temps))=0;').</p><p>Currently I am trying to manipulate the data to create new columns that involve different values based on equations. The second step is to graph these values. So for example I am using an equation to read stress accumulation. In Excel it roughly translates into this</p><p>for i=2:N
temps(i+1,8)=temps(i,8)+temps(i+1,7);
end</p><p>This takes values from the previous stress accumulation and adds it to the current stress at that particular time (thus creating the new stress accumulation value for column 8). The problem I have is that I need a method of allowing the program to distinguish between different particles . All particles are on the same column so the stress is just constantly added. Any suggestions?</p>owen kellyhttps://se.mathworks.com/matlabcentral/profile/authors/7435375-owen-kellytag:se.mathworks.com,2005:Question/1627482014-11-14T19:24:49Z2017-07-20T16:29:02ZHow do i save the state of my GUI and load the saved state again?<p>I am making a program to book airline tickets. Each radio button represents a seat in the plane. I changed the color of each button when selected to indicate that the seat is occupied. This will show the next person who runs the program that he cannot select that seat.............
E.g. of seat names (LW1, LW2, LW3 etc.......)</p><pre class="language-matlab">function uipanel4_SelectionChangeFcn(hObject, eventdata, handles)
A = get(hObject,'String');
switch A
case 'LW1'
if (get(hObject,'Value')== get(hObject,'Max'))
set(hObject, 'BackgroundColor','red')
end
</pre><pre> case 'LW2'
if (get(hObject,'Value')== get(hObject,'Max'))
set(hObject, 'BackgroundColor','red')
end
end</pre><p>How can I save the state of the buttons so that a seat cannot be selected twice?</p><p>I made an "ok" push button to carry out the save function and it didn't work.
This is the code:</p><pre class="language-matlab">function ok_KeyPressFcn(hObject, eventdata, handles)
saveState(handles)
</pre><pre class="language-matlab">function saveState(handles)
state.radioVal = get(handles.radiobutton2,'BackgroundColor');
save ('state.mat', 'state')
</pre><pre class="language-matlab">function loadState(handles)
filename = 'state.mat'
if exist(filename)
load(filename)
set(handles.radiobutton2,'BackgroundColor', state.radioVal);
end
</pre>Rushanehttps://se.mathworks.com/matlabcentral/profile/authors/5879028-rushanetag:se.mathworks.com,2005:Question/1214432014-03-13T20:50:16Z2017-07-20T16:28:22ZError installing third party package Arduino software: Invalid zip file<p>I have the 2013a version of matlab and been trying to install the simulink support package for arduino hardware, but I keep getting the following error:</p><p>"Error installing third party package Arduino software: Invalid zip file "C:\MATLAB\SupportPackages\R2013a\downloads\arduino-1.0-windows.zip"."</p><p>and then the installation stops.</p><p>N.B.: I using windows 8.</p>Haninhttps://se.mathworks.com/matlabcentral/profile/authors/5142446-hanintag:se.mathworks.com,2005:Question/3496202017-07-20T16:22:56Z2017-07-20T16:22:56ZCan I load .mat files in a loop?<p>Hi,</p><p>I have 10 files namely img120.mat, img121.mat, img122.mat, img123.mat, img124.mat, img125.mat, img126.mat, img127.mat, img128.mat, img129.mat. RGB values saved in each .mat file.</p><p>I would like to load each .mat file, then imshow(RGB) to look at each image. Would it be possible to load all the .mat files in a loop rather than do load img120.mat, imshow(RGB), followed by load 121.mat, imshow(RGB), and so on and so forth...</p>Qianqian Panhttps://se.mathworks.com/matlabcentral/profile/authors/6409323-qianqian-pan