http://mathworks.com/matlabcentral/answers/questions.atomMATLAB Answers — New Questions20140901T13:46:34Ztag:mathworks.com,2005:Question/15305520140901T12:03:19Z20140901T13:46:34ZHow to obtain R square value<p>Hi all,</p><p>coefficientsold = polyfit(AAT,QErot1,1)</p><p>Ygg=polyval(coefficientsold,AAT)</p><p>figure</p><p>axis([10 80 0 15])</p><p>plot(AAT,QErot1,'s',AAT,Ygg,'','MarkerFaceColor',[0 0 0])</p><p>By using this code what I obtain is a linear equation that fits my data, but I am not able to obtain the Rsquare value.</p><p>I would be glad if you could tell be how to obtain the rsquare value, if it is possible by the use of the regress function, because I am not able to understand the use of this function properly.</p><p>Thank you very much</p><p>Andoni</p>Andoni Mendialdua/matlabcentral/answers/contributors/5514625andonimendialduatag:mathworks.com,2005:Question/15295620140831T10:32:37Z20140901T13:44:45ZMatlab 2014a parachute problem<p>Here is the code</p><pre class="languagematlab">function dummy=parachute(c)
m=68;
g=9.81;
t=10;
v=45;
c=0.1:20:100;
dummy=v+(g*m./c).*(1exp(c/m)*t);
fplot('parachut',[0,20])
grid on
xlabel('c')
ylabel('f(c)')
</pre><p>here is the error message I am receiving</p><pre class="languagematlab">Maximum recursion limit of 500 reached. Use
set(0,'RecursionLimit',N) to change the limit. Be
aware that exceeding your available stack space can
crash MATLAB and/or your computer.
</pre><pre class="languagematlab">Error in ismember>ismemberlegacy
</pre><p>I want the program to run . then I have to make a function to find "c" at 10 seconds by graphic means in the command window.</p><p>I am stuck with this error messages or another messages.</p>Robert/matlabcentral/answers/contributors/2172750roberttag:mathworks.com,2005:Question/15306220140901T13:44:02Z20140901T13:44:02Zthe first argument of "warning" should be a message identifier<p>Hello, I wrote a matlab command " warning('abc'); ", but the editor detects a problem and underscores the braketed string 'abc' with red wavy line. The given information is:</p><p>The first argument of WARNING should be a message identifier. Using a message identifier allows better control over the message.</p><p>How could I get rid of this thing? Thank you!</p>Zhou/matlabcentral/answers/contributors/4968535zhoutag:mathworks.com,2005:Question/15306020140901T13:29:13Z20140901T13:35:43ZTutorial for live serial input monitoring<p>its my first time post, hope it will be good information. thank you</p><p>this example code :</p><p>clear all;
close all;</p><p>s = serial('COM8'); %assigns the object s to serial port</p><p>set(s, 'FlowControl', 'none');
set(s, 'BaudRate', 9600);
set(s, 'Parity', 'none');
set(s, 'DataBits', 8);
set(s, 'StopBit', 1);</p><p>%clc;
x=0;
fopen(s);
while(1)</p><pre class="languagematlab">a=fscanf(s)
d=str2num(a);
if length(x)>9
for i=2:10
x(i1)=x(i);
end
x(10)=d;
i=2;
else
x=[x d];
end
plot(x);
axis auto;
grid on;
drawnow;
</pre><p>end</p><p>
this is arduino uno example code for serial at adc pin 0</p><p>/*
Analog input, analog output, serial output</p><pre> Reads an analog input pin, maps the result to a range from 0 to 255
and uses the result to set the pulsewidth modulation (PWM) of an output pin.
Also prints the results to the serial monitor.</pre><pre> The circuit:
* potentiometer connected to analog pin 0.
Center pin of the potentiometer goes to the analog pin.
side pins of the potentiometer go to +5V and ground
* LED connected from digital pin 9 to ground</pre><pre> created 29 Dec. 2008
modified 9 Apr 2012
by Tom Igoe</pre><pre> This example code is in the public domain.</pre><pre> */</pre><p>// These constants won't change. They're used to give names
// to the pins used:
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
const int analogOutPin = 9; // Analog output pin that the LED is attached to</p><p>int sensorValue = 0; // value read from the pot
int outputValue = 0; // value output to the PWM (analog out)</p><p>void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}</p><p>void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
// map it to the range of the analog out:
outputValue = map(sensorValue, 0, 1023, 0, 255);
// change the analog out value:
analogWrite(analogOutPin, outputValue);</p><pre class="languagematlab">// print the results to the serial monitor:
//Serial.print("sensor = " );
Serial.println(sensorValue);
//Serial.print(sensorValue,DEC);
//Serial.print("\n");
//Serial.print("\t output = ");
// Serial.println(outputValue);
</pre><pre class="languagematlab">// wait 2 milliseconds before the next loop
// for the analogtodigital converter to settle
// after the last reading:
delay(100);
}
</pre><p>
thank you for read, hope it give good example</p>Dwi D. A/matlabcentral/answers/contributors/3564991dwidatag:mathworks.com,2005:Question/15252520140827T14:53:34Z20140901T13:31:22ZHow to connect and retrieve data from Interactive Brokers <p>I am facing the following error when i type this function:</p><pre class="languagematlab">>> data = IBMatlab('action','account, 'AccountName','DU12345');
data = IBMatlab('action','account, 'AccountName','DU12345');

Error: Unexpected MATLAB expression.
</pre><p>I was reading through some undocumented matlab manuals and official IB manuals indicating that i would need some jar. failes namely: IBMatlab.jar</p><p>I couldnt find these files on the internet neither could Matlab provide me these files and neither Interactive Brokers.</p><p>Would someone be so kind and lead me through the process of connecting Matlab to IB or Trading Working Station which is the interface of IB?</p><p>Thanks in Advance</p>Paul/matlabcentral/answers/contributors/4714160paultag:mathworks.com,2005:Question/15304920140901T11:31:08Z20140901T13:31:17Zmldivide with sparse matrix<p>Hi,</p><p>I need to solve large sparse system of linear equations A*x=b. A is a sparse matrix, but b is vector which has only few zero entries. The question is, regarding memory consumption, when I call</p><pre> mldivide(A,b) </pre><p>when A is sparse matrix and b is full vector, will matlab internally transform A into full matrix and solve the system, or handle it like sparse.</p><p>Thanks!
K</p>Kenan/matlabcentral/answers/contributors/5576815kenantag:mathworks.com,2005:Question/15306120140901T13:30:01Z20140901T13:30:01Zhow can i make a change in my image ?<p>hi guys .
i have an image (257*161) .</p><p>im = f(x,y)</p><p>how can i change my image equation to im = f(x/8 , y/12 )</p><p>could you please help me ?</p><p>thanks</p>hamed/matlabcentral/answers/contributors/3810756hamedtag:mathworks.com,2005:Question/15293120140830T21:30:25Z20140901T13:23:06ZHow to translate the following code from Mathematica to Matlab?<p>I need to construct a matrix similar to the following:</p><p>l = 2; m = 4;
Table[(2 x  y*l)/m, {x, 0, 5}, {y, 0, 5}] // MatrixForm</p><img src = "/matlabcentral/answers/uploaded_files/17590/Untitled.jpg"><p>How can I do that in Matlab?</p>Tigo/matlabcentral/answers/contributors/5560534tigotag:mathworks.com,2005:Question/15275420140829T09:55:33Z20140901T13:21:06ZHow to get analytic expression for experimental data?<p>Hello to everyone, I am new here!</p><p>I can't really formulate a single question but rather would like to describe what I have been doing so far. Being a rather unexperienced programmer I would appreciate help not only on the main issue but on anything that can be done better. So feel free to comment!</p><p>I am solving a system of partial differential equations with "pdepe" which works fine. For the calculation of the discrete intermediate steps I provide a function that is based on experimental data. The experimental data is not easily fit by one analytic expression so I am fitting it piecewise like so</p><p>function W = W_of_DeltaF(dF,material)</p><pre class="languagematlab">if nargin < 2
fprintf('You have to declare a material first!\n');
end
</pre><pre class="languagematlab">switch material
case 'APOTric'
</pre><pre> dF_sp1 = 21.2179113385874;
dF_sp2 = 127.07205949453;
dF_sp3 = 294.787905198327;
dF_sp4 = 409.01335594804;</pre><pre> dF1 = dF(dF<=dF_sp1);
W_coef=[0.33051,0.031024,0.087042];
W1 = W_coef(1)+W_coef(2)*exp(W_coef(3)*dF1);
W1 = W1(:);</pre><pre> dF2 = dF(dF>dF_sp1 & dF<=dF_sp2);
W_coef=[0.34346,0.00138,8.488e005,2.7283e006,4.1173e008,2.8788e01
W_const = 9.9778;
W2 = W_coef(1) ...
+ W_coef(2) * (dF2W_const).^1 ...
+ W_coef(3) * (dF2W_const).^2 ...
+ W_coef(4) * (dF2W_const).^3 ...
+ W_coef(5) * (dF2W_const).^4 ...
+ W_coef(6) * (dF2W_const).^5 ...
+ W_coef(7) * (dF2W_const).^6;
W2 = W2(:);</pre><pre> dF3 = dF(dF>dF_sp2 & dF<=dF_sp3);
W_coef=[0.78166,0.048418,0.00079418,6.4215e006,2.7697e008,6.1208e0
W3 = W_coef(1) ...
+ W_coef(2) * (dF3).^1 ...
+ W_coef(3) * (dF3).^2 ...
+ W_coef(4) * (dF3).^3 ...
+ W_coef(5) * (dF3).^4 ...
+ W_coef(6) * (dF3).^5 ...
+ W_coef(7) * (dF3).^6;
W3 = W3(:);</pre><pre> dF4 = dF(dF>dF_sp3 & dF<=dF_sp4);
W_coef=[1.2677,0.0044196,3.3883e006];
W4 = W_coef(1) ...
+ W_coef(2) * (dF4).^1 ...
+ W_coef(3) * (dF4).^2;
W4 = W4(:);</pre><pre> dF5 = dF(dF>dF_sp4);
W_coef=[0.0015397,0.027218,10.426];
W_const = 408.14;
W5 = W_coef(1)+W_coef(2)*exp((dF5W_const)/W_coef(3));
W5 = W5(:);</pre><pre> W = [W1; W2; W3; W4; W5];</pre><pre> case 'some other material'
do this</pre><pre> otherwise
sprintf('Sorry, you did not provide a valid string for "material".\n');
end</pre><p>This has some disadvantages. The intersection of the analytic functions are often not smooth, i.e. differentiable, which might cause problems. Also this piecewise fitting can get quite tedious and time consuming since it has to be repeated and tuned for every new 'material'.</p><p>I thought about doing something like tracing the limited number of experimental data points with something like GIMP to achieve a smooth curve following the data points.</p><p><i>I know this might sound a little unscientific since it creates data where there is no evidence for it, but I can follow certain physical guidelines when tracing the data that are sensible and I need a qualitative behavior rather than the exact shape.</i></p><p>This curve could then be converted back to a larger amount of data points with some sort of plot digitizer. At this point I am still using the data points for piecewise fitting but was thinking that there might be some way of interpolating the points in order to being able to return data between discrete points. I have tried this once briefly but the program became orders of magnitude slower.</p><p>I hope this wasn't too much babble and someone might still be following up to this point. If further input from my side is needed or would be helpful, anytime!</p><p>Until then!</p><p>Cheers!</p>Markus/matlabcentral/answers/contributors/5568440markustag:mathworks.com,2005:Question/15292020140830T19:41:26Z20140901T13:15:46ZHow to store the coordinates of a bounding box in a video?<p>Hello. I am working on a project where i use a camera to detect moving objects. Now what i want to do is to create a code in order to save the x and y coordinates of a (moving) bounding box (in all the frames of my video that is visible). I tried the code below but it saves only the last x and y ktimes, where k is the number of frames of my video.</p><pre> ....
while ~isDone(hVidReader) % Stop when end of file is reached
frame = step(hVidReader); % Read input video frame</pre><pre> grayFrame = rgb2gray(frame);</pre><pre> %The optical flow vectors are stored as complex numbers.
ofVectors = step(hOpticalFlow1, grayFrame); % Estimate optical flow
%Compute their magnitude squared which will later be used for thresholding.
y1 = ofVectors .* conj(ofVectors);
% Compute the velocity threshold from the matrix of complex velocities.
vel_th = 0.5 * step(hMean2, step(hMean1, y1));
% Threshold the image and then filter it to remove speckle noise.
segmentedObjects = step(hMedianFilt, y1 >= vel_th);
% Thinout the parts of the road and fill holes in the blobs.
segmentedObjects = step(hclose, step(herode, segmentedObjects));
% Estimatethe area and bounding box of the blobs.
[area, bbox] = step(hblob, segmentedObjects);
% Select boxes inside ROI.
Idx = (bbox(:,1) > lineRow1 & bbox(:,1) < lineRow2)&(bbox(:,2) > lineColumn1 & bbox(:,2) <
lineColumn2);
% Based on blob sizes, filter out objects which can not be cars.
% When the ratio between the area of the blob and the area of the
% bounding box is above 0.4 (40%), classify it as a car.
ratio = zeros(length(Idx), 1);
ratio(Idx) = single(area(Idx,1))./single(bbox(Idx,3).*bbox(Idx,4));
ratiob = ratio > 0.4;
count = int32(sum(ratiob)); % Number of cars
bbox(~ratiob, :) = int32(1);
% Draw bounding boxes around the tracked cars.
y2 = step(hshapeins1, frame, bbox);
% Display the number of cars tracked and white lines showing the ROI.
y2(22:25,250:1097,:) = 1; % The top white line.
y2(230:233,250:1097,:) = 1; % The bottom white line.
y2(25:230,247:250,:) = 1; % The left white line.
y2(25:230,1097:1100,:) = 1; % The right white line.
y2(1:15,1:30,:) = 0; % Background for displaying count
result = step(htextins, y2, count);</pre><pre> for jj = 1 : k
if bbox ~ [];
if bbox(1,1)>0
xbbox(jj) = bbox(1,1);
ybbox(jj) = bbox(1,2);
zz(:,:,jj) = [xcentroid,ycentroid];</pre><pre> else
xbbox(jj) = 0;
ybbox(jj) =0;
zz(:,:,jj) = 0;
end
end
end</pre><pre> % Generate coordinates for plotting motion vectors.
if firstTime
[R , C] = size(ofVectors); % Height and width in pixels
RV = borderOffset:decimFactorRow:(RborderOffset);
CV = borderOffset:decimFactorCol:(CborderOffset);
[Y ,X] = meshgrid(CV,RV);
firstTime = false;</pre><pre> end</pre><pre> % Calculate and draw the motion vectors.
tmp = ofVectors(RV,CV) .* motionVecGain;
lines = [Y(:), X(:), Y(:) + real(tmp(:)), X(:) + imag(tmp(:))];
motionVectors = step(hshapeins2, frame, lines);
% Display the results</pre><pre> step(hVideo4, result); % Video with bounding boxes</pre><pre> end
release(hVidReader);</pre><p>The lines i was talking about are:
for jj = 1 : k
if bbox ~ [];
if bbox(1,1)>0
xbbox(jj) = bbox(1,1);
ybbox(jj) = bbox(1,2);
zz(:,:,jj) = [xcentroid,ycentroid];</p><pre> else
xbbox(jj) = 0;
ybbox(jj) =0;
zz(:,:,jj) = 0;
end
end
end</pre><p>I also tried other things but the outcome was about the same. I don't know if i gave you adequate iinformation, so please ask me anything you want. Thank you all in advance.</p>Nikolaos/matlabcentral/answers/contributors/5367525nikolaostag:mathworks.com,2005:Question/15305220140901T11:37:12Z20140901T13:13:27ZHow to understand gui handles ?<p>Hello,</p><p>I'm programming a GUI. I need help by understanding how handles are working. This is simple code :</p><p>Starting creating a Structure S.
Storing my figure into it.</p><pre class="languagematlab">S.f = figure('Position', [400,400,1000,400], ...
'Name', 'Store data');
</pre><p>Storing an edit box and a pushbutton.</p><pre class="languagematlab">S.eT_name = uicontrol( 'Style', 'edit', ...
'Position', [400,100,200,50], ...
'FontSize', 15, ...
'BackgroundColor', 'white');
</pre><pre class="languagematlab">S.pB_save = uicontrol( 'Style', 'pushbutton', ...
'String', 'Save', ...
'Position', [700,75,200,50], ...
'FontSize', 20, ...
'BackgroundColor', 'red');
</pre><p>Setting callbacks.</p><pre class="languagematlab">set(S.pB_save, 'Callback', {@pB_save_callback, S});
set(S.eT_name, 'Callback', {@eT_name_callback, S});
</pre><p>Here are the 2 Callback functions.</p><pre class="languagematlab">function [] = eT_name_callback(hObject, eventdata, S)
s_Name = get(hObject, 'String');
set(S.data, 's_Name', s_Name);
guidata(S.f, S.data);
</pre><pre class="languagematlab">function [] = pB_save_callback(hObject, eventdata, S)
display(S.data);
</pre><p>My questions are :</p><p> How can i save the string, that I'm getting by the edit box, into my GUI so that I can display it by clicking on the pushbutton ?</p><p> I supposed S is the guihandle, isn't it ? Is there a solution so that i can create for example an array into the GUI to save data ?</p><p>Thank you in advance.</p>Adrien/matlabcentral/answers/contributors/5409896adrientag:mathworks.com,2005:Question/15302920140901T07:01:50Z20140901T13:09:31ZHow can I perform Mixed Integer MultiObjective optimization in matlab<p>I have an optimization problem that includes;</p><p>1 Multiobjective functions
2 linear constraints
3 binary variables [0 or 1]
4 integer variables</p><p>How can I solve it using MATLAB ? as far as I know , gamultiobj in matlab doesn't support integer and binary variables, and I don't have enough background to code population , mutation and crossover function, if modifying the codes is a must, what shall I do to understand how to original code works ..etc?</p><p>Thanks a lot</p>Sadeque/matlabcentral/answers/contributors/5575991sadequetag:mathworks.com,2005:Question/15244720140826T20:47:51Z20140901T13:07:32Zdeploytool problems and incompatible JVM.<p>hi, change the JVM version of matlab for my computer, I use windows 7, and is installed matlab ml2013a, both 64 bits.</p><p>the root of the problem is that I try to deploy an application in java and threw the following error:</p><p><b>3 errors
8 warnings
Error: An error occurred while shelling out to javadoc (Error code = 1).
Unable to build executable</b>.</p><p>such error to me was hard to track, and alleged that I found only solution to the problem was to change the JVM matlab for compatibility with windows. and java version on my computer is:</p><p><b>java version "1.8.0_20"
Java (TM) SE Runtime Environment (build 1.8.0_20b26)
Java HotSpot (TM) 64Bit Server VM (build 25.20b23, mixed mode)</b>.</p><p>matlab version is:</p><p><b>1.6.0_17b04 Java with Sun Microsystems Inc. Java HotSpot (TM) 64Bit Server VM mixed mode</b></p><p>... I changed the version as explained in this link: <a href = "http://www.mathworks.com/matlabcentral/answers/130359howdoichangethejavavirtualmachinejvmthatmatlabisusingonwindows">http://www.mathworks.com/matlabcentral/answers/130359howdoichangethejavavirtualmachinejvmthatmatlabisusingonwindows</a>.</p><p>and now I get the following error in matlab:</p><pre class="languagematlab">>> deploytool
Error using deploytool (line 43)
Java exception occurred:
java.lang.IllegalArgumentException: java.lang.RuntimeException:
XPathFactory#newInstance() failed to create an XPathFactory for the default object
model: http://java.sun.com/jaxp/xpath/dom with the XPathFactoryConfigurationException:
javax.xml.xpath.XPathFactoryConfigurationException: java.util.ServiceConfigurationError:
javax.xml.xpath.XPathFactory:
jar:file:/C:/Program%20Files/MATLAB/R2013a/java/jarext/saxon9xpath.jar!/METAINF/services/javax.xml.xpath.XPathFactory:2:
Illegal configurationfile syntax
</pre><pre class="languagematlab"> at
com.mathworks.project.impl.plugin.DefaultXpathEvaluator.compileXPath(DefaultXpathEvaluator.java:42)
</pre><pre class="languagematlab"> at
com.mathworks.project.impl.plugin.DefaultXpathEvaluator.compileXPath(DefaultXpathEvaluator.java:15)
</pre><pre class="languagematlab"> at
com.mathworks.project.impl.plugin.SimpleExpression$1.run(SimpleExpression.java:465)
</pre><pre class="languagematlab"> at
com.mathworks.project.impl.plugin.SimpleExpression$Token.getCompiledXpath(SimpleExpression.java:394)
</pre><pre class="languagematlab"> at
com.mathworks.project.impl.plugin.SimpleExpression$TokenType$2.evaluate(SimpleExpression.java:146)
</pre><pre class="languagematlab"> at
com.mathworks.project.impl.plugin.SimpleExpression.evaluate(SimpleExpression.java:63)
</pre><pre class="languagematlab"> at
com.mathworks.project.impl.plugin.ExpressionBasedTargetAttribute.evaluateString(ExpressionBasedTargetAttribute.java:73)
</pre><pre class="languagematlab"> at
com.mathworks.project.impl.plugin.ExpressionBasedTargetAttribute.evaluateBoolean(ExpressionBasedTargetAttribute.java:67)
</pre><pre class="languagematlab"> at com.mathworks.project.impl.model.Target.isEnabled(Target.java:276)
</pre><pre class="languagematlab"> at
com.mathworks.project.impl.plugin.PluginManager.readTargets(PluginManager.java:590)
</pre><pre class="languagematlab"> at
com.mathworks.project.impl.plugin.PluginManager.getTargets(PluginManager.java:232)
</pre><pre class="languagematlab"> at
com.mathworks.project.impl.plugin.PluginManager.getLicensedTargets(PluginManager.java:264)
</pre><pre class="languagematlab"> at
com.mathworks.project.impl.plugin.PluginManager.getLicensedTargetsEDT(PluginManager.java:259)
</pre><pre class="languagematlab"> at com.mathworks.project.impl.NewOrOpenDialog.invoke(NewOrOpenDialog.java:504)
</pre><pre class="languagematlab"> at com.mathworks.project.impl.NewOrOpenDialog.invoke(NewOrOpenDialog.java:489)
</pre><pre class="languagematlab"> at com.mathworks.project.impl.NewOrOpenDialog.invoke(NewOrOpenDialog.java:482)
</pre><pre class="languagematlab"> at
com.mathworks.toolbox.compiler.plugin.DeploytoolCommandLineParser.startDeploytoolGUI(DeploytoolCommandLineParser.java:138)
</pre><pre class="languagematlab"> at
com.mathworks.toolbox.compiler.plugin.DeploytoolCommandLineParser.parse(DeploytoolCommandLineParser.java:66)
</pre><pre class="languagematlab">Caused by: java.lang.RuntimeException: XPathFactory#newInstance() failed to create an
XPathFactory for the default object model: http://java.sun.com/jaxp/xpath/dom with the
XPathFactoryConfigurationException: javax.xml.xpath.XPathFactoryConfigurationException:
java.util.ServiceConfigurationError: javax.xml.xpath.XPathFactory:
jar:file:/C:/Program%20Files/MATLAB/R2013a/java/jarext/saxon9xpath.jar!/METAINF/services/javax.xml.xpath.XPathFactory:2:
Illegal configurationfile syntax
</pre><pre class="languagematlab"> at javax.xml.xpath.XPathFactory.newInstance(XPathFactory.java:102)
</pre><pre class="languagematlab"> at
com.mathworks.project.impl.plugin.DefaultXpathEvaluator.compileXPath(DefaultXpathEvaluator.java:38)
</pre><pre class="languagematlab"> ... 17 more
</pre><pre class="languagematlab">>>
</pre><p>por favor si alguien me puede ayudar le estaré enormemente agradecido.</p>kevin jessid figueroa/matlabcentral/answers/contributors/5259368kevinjessidfigueroatag:mathworks.com,2005:Question/15199320140822T19:03:53Z20140901T13:06:10ZMATLAB deploytool → javadoc (error code = 1)<p>hello people, sorry, I'm not very good with English, but I will try to express my problem best. I'm trying to deploy a java package with deploytool, I installed microsoft SDK requirements, I installed java:</p><p>_C: \ Users \ kevin> java version
java version "1.8.0_05"
Java (TM) SE Runtime Environment (build 1.8.0_05b13)
Java HotSpot (TM) 64Bit Server VM (build 25.5b02, mixed mode)</p><p>C: \ Users \ kevin> javac version
javac 1.8.0_05_</p><p>I also also set environment variables <i>C:\Program Files\Java\jdk1.8.0_05</i>.
and I have given in matlab <i>mbuild setup</i> and have also verified his version of java and says this:</p><p>>>version java</p><p>ans =</p><p>Java 1.6.0_17b04 with Sun Microsystems Inc. Java HotSpot (TM) 64Bit Server VM mixed mode</p><p>start working once deloytool ends with: <i>3 errors
8 warnings
Error: An error occurred while shelling out to javadoc (Error code = 1).
Unable to build executable.</i>
Please I appreciate the help.</p>kevin jessid figueroa/matlabcentral/answers/contributors/5259368kevinjessidfigueroatag:mathworks.com,2005:Question/15305720140901T12:58:16Z20140901T13:00:17ZUsing recursive nlinfit for estimating better parameter values<p>Recently I found some good stuff on parameter fitting: <a href = "http://people.ece.cornell.edu/land/PROJECTS/MKG23curvefit/index.html">SPECIALLY THIS ONE</a></p><p>However I want to modify same program for higher order ODE, i.e.:</p><p>1. My ODE function is:</p><pre class="languagematlab">function F = myfun(c,ydata)
</pre><pre class="languagematlab">F = [c(1)*ydata(1,:) + c(2)*(ydata(2,:));
</pre><pre> (c(3)*ydata(3,:)) + c(4)*ydata(1,:);</pre><pre> c(5)*ydata(2:1)];</pre><p>2. The X & Y data are as follows:</p><pre class="languagematlab">xdata = [0 1 2 3 4 5 6 7 8 9]; (it is time axis, which is same for all ODEs)
</pre><pre class="languagematlab">ydata = [3.6 7.7 9.3 4.1 8.6 2.8 1.3 7.9 10.0 5.4;
</pre><pre> 6 7 3 1 6 8 3 7 1 5;</pre><pre> 3 17 9 4 8 2 1 9 2 4];</pre><p>Note: First row of ydata denotes 10 desired points of 1st ODE, and so on (till 3).</p><p>3. The starting guess of unknown parameters: c(1), c(2), c(3), c(4), c(5) i.e.</p><pre class="languagematlab">c0 = [1, 1, 1, 1, 1]
</pre><p>IS IT POSSIBLE THAT I CAN MODIFY THE <a href = "http://people.ece.cornell.edu/land/PROJECTS/MKG23curvefit/index.html">ABOVE PROGRAM</a> & USE IT FOR MY PROBLEM?</p><p>& IS THIS APPROACH MORE FRUITFUL THAN USING GENETIC ALGORITHM?</p>Learner/matlabcentral/answers/contributors/3146716learnertag:mathworks.com,2005:Question/15301620140901T01:17:34Z20140901T12:50:18Z I get an error, could you guys help me to figure out?<p>Error using bsxfun
Out of memory. Type HELP MEMORY for your options.</p><p>Error in classreg.learning.internal.wnanmean (line 12)
X = bsxfun(@times,X,W);</p><p>Error in pca (line 284)
mu = classreg.learning.internal.wnanmean(x, vWeights);</p><p>Error in princomp (line 29)
[varargout{1:nargout}]=pca(varargin{1},'Algorithm','svd','Economy',fEconomy);</p><p>Error in pca_for_Zhen (line 36)
[coeff, score, latent]=princomp(data,'econ');</p><pre> [fname pname]=uigetfile('*.*','Please click any image in your folder');
cd(pname);
filenamelist=dir(pwd);
nel=length(filenamelist);
index=0;
sampleImage=im2double(imread(fname));
vsampleImage=sampleImage(:);
[numRows numCols]=size(sampleImage);
data=zeros(size(vsampleImage,1),200);
label='Zhen sample';</pre><pre> for i=3:1:102
% here you are try from 3 (the first image with signal) to any arbitrary
% number and find out how many frames you need in your case. This number
% is different since the exposure time and frame rate is different from
% our setup to your imaging setup.
if filenamelist(i).isdir~=1
if mod(i,1)==0
index=index+1
fname=filenamelist(i).name;
tempData=im2double(imread(fname));
data(:,index)=tempData(:);
end
end
end</pre><pre class="languagematlab">[coeff, score, latent]=princomp(data,'econ');
n=score>=0;
posscore=n.*score;
m=score<=0;
negscore=m.*score;
</pre><pre> figure</pre><pre> for j=1:9
subplot(3,3,j)
pcolor(reshape(score(:,j),numRows,numCols));axis image;shading flat;axis ij;
text(5,20,[label ' ' sprintf('%d',j)],'Color','w','FontWeight','bold')
axis off;
colormap jet;
end
cd('..');
%print(gcf,'dpdf',[label ' components.pdf']);</pre><pre class="languagematlab">%rgb overlay
impos=zeros(numRows,numCols);
%positive
</pre><pre> impos(:,:,1)=reshape(posscore(:,2),numRows,numCols);
impos(:,:,2)=reshape(posscore(:,3),numRows,numCols);
impos(:,:,3)=reshape(posscore(:,4),numRows,numCols);
for k=1:3</pre><pre> impos(:,:,k)=impos(:,:,k)/max(max(impos(:,:,k)));
end
figure
image(impos);
axis image;
title([label ' Positive']);
%print(gcf,'dpdf',[label ' positive.pdf']);</pre><pre class="languagematlab">%negative
</pre><pre> imneg=zeros(numRows,numCols);</pre><pre class="languagematlab">imneg(:,:,1)=reshape(negscore(:,2),numRows,numCols);
imneg(:,:,2)=reshape(negscore(:,3),numRows,numCols);
imneg(:,:,3)=reshape(negscore(:,4),numRows,numCols);
for k=1:3
</pre><pre> imneg(:,:,k)=imneg(:,:,k)/max(max(imneg(:,:,k)));
end
figure
image(imneg);
axis image;
title([label ' Negative']);
%print(gcf,'dpdf',[label ' negative.pdf']);</pre><p>imoverlay=zeros(numRows,numCols);
for k=1:3</p><pre> imoverlay(:,:,k)=impos(:,:,k)+imneg(:,:,k);
imoverlay(:,:,k)=imoverlay(:,:,k)/max(max(imoverlay(:,:,k)));</pre><pre class="languagematlab">end
figure
image(imoverlay);
axis image;
title([label ' Overlay']);
</pre>Zhen Weng/matlabcentral/answers/contributors/5493344zhenwengtag:mathworks.com,2005:Question/15295820140831T10:44:09Z20140901T12:42:58ZNow I get stuck with how to plot ASK demodulation in matlab. Could anyone help me please?<p>Now I get stuck with how to plot ASK demodulation in matlab. Could anyone help me please?</p>Ny Sokunthea/matlabcentral/answers/contributors/5545252nysokuntheatag:mathworks.com,2005:Question/15305620140901T12:33:36Z20140901T12:33:36Zpolar plot label problem<p>using the command polar, MATLAB automatically shows the angles start from 0 angles at the direction of 3'o clock.</p><p>But I want to set the label as 0 degree at the 12'o clock direction and to 90degree at the 9'o clock and so on.</p><p>I need to angle 0 to 360 degree label dividing 10degrees.</p><p>So linspace(0,360,10)</p><p>Can anyone give me a hint? I tried to change, but it somehow didn't work out...</p><p>Clara...</p>Hwang/matlabcentral/answers/contributors/3584418hwangtag:mathworks.com,2005:Question/14681720140808T10:14:31Z20140901T12:22:49ZTrying to plot 3d<p>My equation is</p><pre class="languagematlab">dxdt=N0*sin(omega*t)*x*(1x/K);
N0=1:1:10;
omega=1:1:10;
</pre><p>I want to plot 3D for N0,omega,Xmax and Xmean.</p><p>I am trying with the following code but it does not work.</p><pre class="languagematlab">function RunOsciliationsky3D
N0all= 1:1:10;
N=length(N0all);
omegaall= 1:1:10;
M=length(omegaall);
Pmax=zeros(N,M);
Pmean=zeros(N,M);
Pall=[Pmax,Pmean];
x=size(Pall);
</pre><pre class="languagematlab">for i=1:N
for j =1:N
[t,x]=ode45(@osciliation,[0 100],0.1,[],N0all(i),10,omegaall(j));
Pall(i,j)=x;
end
end
[N0x,omegay]=meshgrid(N0all,omegaall);
h=mesh(N0x,omegay,Pall);
</pre><p>1;</p>Avan AlSaffar/matlabcentral/answers/contributors/5297065avanalsaffartag:mathworks.com,2005:Question/15259720140828T05:27:59Z20140901T12:19:32Zneed to generate a signal as attached.<p>Hi all,</p><p>I will get my input samples as shown in attached figure.</p><p>So to check with that, i need to generate the samples as shown in attached figure.</p><p>It has samples with unequal spacing and unequal amplitudes.</p><p>I need to generate a signal like the attached figure.</p><p>Could anyone plz help me out in generating the signal as shown in attached figure.</p><img src = "/matlabcentral/answers/uploaded_files/17472/tacho_eg2.GIF">LAKSHMAN/matlabcentral/answers/contributors/5512402lakshmantag:mathworks.com,2005:Question/15305320140901T11:44:49Z20140901T12:16:43ZPlotting mean of the columns of image on that image<p>I am struggling to plot the mean of the columns of the gray scale image on the same image. Mean of the columns of an image can be found by using Mean command in Matlab, but i don't have any idea how to plot it in image coordinates. Any idea or help is appreciated! Thank you :)</p>Yawar Rehman/matlabcentral/answers/contributors/1607545yawarrehmantag:mathworks.com,2005:Question/15302220140901T03:59:07Z20140901T12:14:21ZMatlab very slow at initialization and execution. Why?<p>Hi,</p><p>I recently upgraded my matlab version to 2013a from 2011. I had a network license earlier and now a license key. I have a mac (Mavericks  10.9.4) and uninstalled 2011 before I installed 2013a. But every since its installation, matlab has become extremely slow. It takes a really long time for initialization (approx 5 mins after opening the window) and then a very long time every time I run simple commands (like print a 2x2 matrix that I just defined). I also upgraded to JAVA (jdk and jre) to 1.7 version.</p><p>Thanks,
PH</p>Pavithra/matlabcentral/answers/contributors/2357755pavithratag:mathworks.com,2005:Question/15305420140901T11:51:27Z20140901T11:51:27ZHow to add a categorical variable with a power of 2 to the rowexch function (Dopt design) <p>Hello,</p><p><b>Given:</b>
A regression model with polynomial function 'poly42111'. The second factor has a power of 2 and is/can modeled as a continuous variable. However, the complete data set only has 4 levels of this factor.</p><p><b>Problem:</b>
To reduce the amount of data points required the model is subjected to a Doptimal design, by means of the rowexch function. To ensure the Doptimal design matrix contains available data only  thus a selection of the four levels for the second factor  the function is defined as follows:</p><p><b>dRE1 = rowexch(nfactors,points,'poly42111','categorical',2,'levels',4);</b></p><p>but now the following error occurs:</p><p><i>MODEL cannot specify powers for a categorical variable.</i></p><p>The rowexch function does not support categorical variables with power > 1. In fact, a simple regression model neither supports a factor with power >1 to be defined as categorical...</p><p><b>Question:</b>
Does anyone have a solution to this? different method / postaugmentation of this factor..</p><p>Help is much appreciated, thanks in advance!</p><p>Floris</p>Floris Bremmers/matlabcentral/answers/contributors/5576788florisbremmerstag:mathworks.com,2005:Question/15305120140901T11:34:24Z20140901T11:34:24ZCould anyone check my code please? Because nu represents the mean value so there is someone who expected to got my frequency at 1!!<p>My system is</p><p>function dgdt=stochasticnu(t,g,S0,Sr,nu)</p><p>% The system consists of two competing species,Grass density and Woodyvegetation density with cattlestocking rate</p><p>dgdt(1)=1.5*g(1)*(1(S0+Sr*cos(nu*t))0.7*g(1)g(2));
dgdt(2)=0.03 + g(2)*(12*g(1)1.03*g(2));
dgdt=[dgdt(1) dgdt(2)]';</p><p>end</p><p>My code is:</p><p>function RunStocnnu</p><p>% Finding the DFT(Discrete Fourier Transform ) using FFT procedure to get the spectrum plot of the system of two competing species, Grass density and Woodyvegetation density after adding a small perturbation to the cattlestocking rate.</p><p>tinit=0; % The initial time</p><p>tf=50; % The final time</p><p>h=0.1; % Step size</p><p>tspan=tinit:h:tf; % The integration time vector</p><p>S0=.3;</p><p>Sr=.1;</p><p>g0=[0.1,0.1]; % The initial conditions</p><p>nu=1;</p><p>[t,g]=ode45(@stochasticnu,tspan,g0,[],S0,Sr,nu); % ODE solver</p><p>% Begin a new figure</p><p>figure(01)</p><p>plot(g(:,1),g(:,2),'k*') % plotting the phase plane of the two species</p><p>xlabel('Grass density') % The x axis</p><p>ylabel('Woodyvegetation density') % The y axis</p><p>title('A trajectory of stochastic system') % The title of the figure</p><p>n=length(g); % The length of the input data vector</p><p>dt=t(end)/(length(g)1);</p><p>Fs=1/dt;</p><p>% T=1/Fs;</p><p>NFFT =n;</p><p>y=fft(g,NFFT)/n;</p><p>y=y(1:NFFT/2);</p><p>mx=abs(y);</p><p>f=(0:NFFT/21)*(Fs/NFFT); % The frequency range</p><p>figure(02)</p><p>plot(f(1:50),y(1:50)); % FFT is symmetric, throw away second half</p><p>xlabel('Frequency')</p><p>figure(03)</p><p>plot(f,mx)</p><p>1;</p>Avan AlSaffar/matlabcentral/answers/contributors/5297065avanalsaffartag:mathworks.com,2005:Question/15304820140901T11:29:39Z20140901T11:29:39ZLag in output from NarNetwork (narnet)<p>% Solve an Autoregression TimeSeries Problem with a NAR Neural Network % Script generated by Neural Time Series app % This script assumes this variable is defined: % % solarTargets  feedback time series.</p><p>T = solarTargets;</p><p>trainFcn = 'trainlm'; % LevenbergMarquardt feedbackDelays = 1:6; hiddenLayerSize = 10; net = narnet(feedbackDelays,hiddenLayerSize,'open',trainFcn); net.input.processFcns = {'removeconstantrows','mapminmax'}; [x,xi,ai,t] = preparets(net,{},{},T); net.divideFcn = 'dividerand'; % Divide data randomly net.divideMode = 'time'; % Divide up every value net.divideParam.trainRatio = 70/100; net.divideParam.valRatio = 15/100; net.divideParam.testRatio = 15/100;</p><p>net.performFcn = 'mse'; % Mean squared error net.plotFcns = {'plotperform','plottrainstate','plotresponse', ... 'ploterrcorr', 'plotinerrcorr'};</p><p>% Train the Network [net,tr] = train(net,x,t,xi,ai);</p><p>% Test the Network y = net(x,xi,ai); e = gsubtract(t,y); performance = perform(net,t,y)</p><p>% Recalculate Training, Validation and Test Performance trainTargets = gmultiply(t,tr.trainMask); valTargets = gmultiply(t,tr.valMask); testTargets = gmultiply(t,tr.testMask); trainPerformance = perform(net,trainTargets,y) valPerformance = perform(net,valTargets,y) testPerformance = perform(net,testTargets,y)</p><p>% View the Network view(net)</p><p>% Closed Loop Network netc = closeloop(net); [xc,xic,aic,tc] = preparets(netc,{},{},T); yc = netc(xc,xic,aic); perfc = perform(net,tc,yc)</p><p>% Multistep Prediction [x1,xio,aio,t] = preparets(net,{},{},T); [y1,xfo,afo] = net(x1,xio,aio); [netc,xic,aic] = closeloop(net,xfo,afo); [y2,xfc,afc] = netc(cell(0,5),xic,aic);</p><p>% StepAhead Prediction Network nets = removedelay(net); [xs,xis,ais,ts] = preparets(nets,{},{},T); ys = nets(xs,xis,ais); stepAheadPerformance = perform(net,ts,ys)</p><img src = "/matlabcentral/answers/uploaded_files/17641/help.png"><p>As shown in figure I am observing a lag in targets and output. But same was not observed when code ran for laserTargets series. For sake of understanding a lag only 20 values are plotted.</p><p>Help me to understand how to use "narnet".</p><img src = "/matlabcentral/answers/uploaded_files/17642/help1.png">Kalpesh Patil/matlabcentral/answers/contributors/2900464kalpeshpatiltag:mathworks.com,2005:Question/15304720140901T10:59:52Z20140901T11:29:24Zmaximum variable size allowed by the program is exceeded?<p>PLz help me</p><p>This is the code</p><pre> alps=17; %slope angle
dz=200; %depth of water table from the suface
dlz=400; % toltal depth of slope
fi=25; %friction angle
C=0.4; %4 kpa=0.4 N/cm^2
gsat=0.21; %21 kN/m^3
gw=0.098; %9.81 Kn/m^3
Dzero=4; %0.0004m^2/s
ksat=1e3; %e5 m/s
iz=2e4; %iz=7.2 mm/h= 2e4 cm/s
deltat=10; %time step
deltaz=0.8; %space step
T=12*60*60; %time duration of rainfall= 12h to seconds
e=(deltat/deltaz^2)*Dzero*cos(17*pi/180)*cos(17*pi/180);
n=500; %time step, based on T</pre><pre> %Setup sparse matrix</pre><pre> b= sparse(1:n,1:n,116.314,n,n); % element b... 1...n
c= sparse(1:n1,2:n,e,n,n); % element c...
a= sparse(2:n,1:n1,e,n,n); % element a... 2...n1</pre><pre> c(1)=114.314; a(1)=0; a(n)=114.314; %Boundary condition
A= a+b+c;</pre><pre> l=e*ones(1:n); m=112.314*ones(1:n); u=e*ones(1:n);</pre><p>and
This is the error below, please tell me why this error appears and how to solve.
My system is 64 bit and 6gb ram and processor speed is 2.5 Ghz
Error using ones
Maximum variable size allowed by the program is exceeded.</p><pre> Error in hillslopesparse (line 30)
l=e*ones(1:n); m=112.314*ones(1:n); u=e*ones(1:n);</pre>advaita vedanta/matlabcentral/answers/contributors/2227782advaitavedantatag:mathworks.com,2005:Question/6736520130315T17:14:02Z20140901T11:21:04ZMatlab GUI zoom in/out<p>Hey all,</p><p>Plot some data, go ahead, do it. You'll see that in the toolbar that there is a zoom "in" and zoom "out". Both yeild the curser to do two different things. I'm trying to program this function into a gui I'm making with my own zoom in and zoom out buttons. The zoom in works with the "zoom" function within the callback function, but I can't for the life of me figure out how to make the too do the opposite. Any suggestions? Thanks!</p><p>Trevor</p>Trevor Harris/matlabcentral/answers/contributors/3447833trevorharristag:mathworks.com,2005:Question/15304620140901T10:35:56Z20140901T11:09:48Zrandom selection for running functions sequentially <p>Hello;
I have a problem with different data, which I can't put them in a matrix.
for example, I have 3 houses with different appliances and an optimization problem for each of them.
I want put each optimization problem in a function. for example,OF1, OF2 & OF3.
the problem is a game between this houses , and in each iteration of that, I've used: "randperm(1,3)" to arrange the sequence of players. I mean the sequence in iteration one is 3,2,1 and in next one is may be 2,3,1.
I don't know how should I arrange the sequence of runninf the functios OF1, OF2 &OF3 ?
could you please help me?
Thanks so much in advance.</p>Maryamm Bodaghi/matlabcentral/answers/contributors/5445860maryammbodaghitag:mathworks.com,2005:Question/15303420140901T07:58:40Z20140901T10:57:59ZHow to convert multiple date formats in a loop?<p>I am processing data from an instrument, where the time read out is something like this</p><p>'29/08/2014 14:31'</p><p>'31:41.0'</p><p>'31:41.1'</p><p>'31:41.1'</p><p>Where the full date stamp repeats around every 20 readings, but this isn't constant, so I cannot just select the data every 20th reading.</p><p>However, when using datestr on the '31:41.0' type readings, it comes out as the 1st January 2014 00:31:41.0.</p><p>I have a method of converting '31:41.0' readings to the correct date by taking the difference between the first long reading and the 1st Jan 2014 datenums and then using add time to correct for the minutes but only for one cell at a time.</p><p>What I would like to do is loop through the data and do something like;</p><p>if date stamp is in the long format use method 1 datenum(data(1,1),'dd/mm/yyyy HH:MM')</p><p>else, use method 2</p><p>so I end up with a new column of the correct datenums.</p><p>The size of the matrix does vary for the filesets.</p><p>I have no idea how to go about this, so any help and suggestions would be appreciated.
Thanks!</p>Hannah/matlabcentral/answers/contributors/3116496hannahtag:mathworks.com,2005:Question/14567820140804T09:18:37Z20140901T10:45:00ZHow can I save a string from a uicontrol edit box into a a part of my structure ?<p>Hello,</p><p>I working on a Programmatic GUI. I have an editbox wich allow the user to enter a string. What I want is to save it into the GUI and not only into the callback function. My edtibox and the file into I want to save the string are in a Structure.</p><pre class="languagematlab">S.f = figure('Position', [500,150,1000,700], ...
'name', 'GUI2');
</pre><pre class="languagematlab">S.eT_name = uicontrol( 'Style', 'edit', ...
'Position', [400,100,200,50], ...
'FontSize', 15, ...
'BackgroundColor', 'white');
</pre><pre class="languagematlab">S.s_name = [];
</pre><pre class="languagematlab">function [] = eT_name_callback(varargin)
S = varargin{3};
s_Name = get(varargin{1}, 'String');
display(s_Name);
S.s_name = s_Name;
display(S.s_name);
</pre><p>But the problem is, he is saving it only local. The second way I've tryed it, was with set. But it didn't worked also. I think it was because of a format file ... How can I solve it. One other question. Are set and get only for uicontrol or can i use it also to set a string into a variable that I created ?</p><p>Thank you in advance</p>Adrien/matlabcentral/answers/contributors/5409896adrientag:mathworks.com,2005:Question/15304520140901T10:33:07Z20140901T10:33:07ZHardware triggered, continuous video acquisition with Basler GigE camera<p>I am using a Basler acA130060gm camera. I am able to acquire video using the matlab gigE drivers either with imaqtool, or directly through matlab. I can trigger the acquisition of a single frame with an external hardware trigger, but my problem is that I need to acquire multiple frames per hardware trigger, and am unable to do this.</p><p>The Basler proprietary drivers (which are now uninstalled, as per matlab gigE installation instructions) have an "AcquisitionMode" setting to switch between single frame and continuous mode. However, this property does not appear on the Imaqtool device properties, which I understood to mean that I cannot access it via matlab. Setting the vidobj.FramesPerTrigger to a value greater than one does not seem to have any effect. I was understanding this to mean that the camera is fixed in SingleFrame by the GigE controller, and that this overrides Matlab's FramesPerTrigger  could this be?</p><p>Below are my current camera settings.</p><p>If anyone has experience with continuous, triggered video acquisition through Matlab using a Basler gigE Camera, and has any thoughts/suggestions, they would be much appreciated. Am I missing an obvious way to access the AcquisitionMode parameter?</p><p>Many thanks in advance
Iris</p><p>
src =</p><pre> Display Summary for Video Source Object:</pre><pre> General Settings:
Parent = [1x1 videoinput]
Selected = on
SourceName = input1
Tag = [0x0 string]
Type = videosource</pre><pre> Device Specific Properties:
AcquisitionFrameRateAbs = 25
AcquisitionFrameRateEnable = True
AcquisitionStartTriggerActivation = RisingEdge
AcquisitionStartTriggerDelayAbs = 0
AcquisitionStartTriggerMode = On
AcquisitionStartTriggerSource = Line1
ActionCommandCount = 1
ActionDeviceKey = 0
ActionGroupKey = 0
ActionGroupMask = 0
ActionSelector = 1
AllBlackLevelRaw = 0
AllGainRaw = 0
AnalogAllGainRaw = 0
AOI1AutoFunctionAOIHeight = 1024
AOI1AutoFunctionAOIOffsetX = 1
AOI1AutoFunctionAOIOffsetY = 1
AOI1AutoFunctionAOIUsageIntensity = True
AOI1AutoFunctionAOIUsageWhiteBalance = False
AOI1AutoFunctionAOIWidth = 1280
AOI2AutoFunctionAOIHeight = 1024
AOI2AutoFunctionAOIOffsetX = 1
AOI2AutoFunctionAOIOffsetY = 1
AOI2AutoFunctionAOIUsageIntensity = False
AOI2AutoFunctionAOIUsageWhiteBalance = True
AOI2AutoFunctionAOIWidth = 1280
AutoExposureTimeAbsLowerLimit = 20
AutoExposureTimeAbsUpperLimit = 350000
AutoFunctionProfile = GainMinimum
AutoGainRawLowerLimit = 0
AutoGainRawUpperLimit = 95
AutoTargetValue = 128
BalanceWhiteAdjustmentDampingAbs = 0.97656
BalanceWhiteAdjustmentDampingRaw = 1000
BinningHorizontal = 1
BinningModeHorizontal = Summing
BinningModeVertical = Summing
BinningVertical = 1
CenterX = False
CenterY = False
Counter1CounterEventSource = FrameTrigger
Counter1CounterResetSource = Off
Counter2CounterEventSource = FrameStart
Counter2CounterResetSource = Off
DecimationHorizontal = 1
DecimationVertical = 1
DeviceFirmwareVersion = 10620010;U;acA1300_60g;V3.156;0
DeviceID = 21531505
DeviceManufacturerInfo = none
DeviceModelName = acA130060gm
DeviceScanType = Areascan
DeviceUserID = [0x0 string]
DeviceVendorName = Basler
DeviceVersion = 10620010
DigitalAllGainRaw = 0
DigitalShift = 0
ExpertFeature1_LegacyExpertFeatureAccessKey = 0
ExpertFeature1_LegacyExpertFeatureEnable = False
ExpertFeature1ExpertFeatureAccessKey = 0
ExpertFeature1ExpertFeatureEnable = False
ExpertFeature2ExpertFeatureAccessKey = 0
ExpertFeature2ExpertFeatureEnable = False
ExpertFeature3ExpertFeatureAccessKey = 0
ExpertFeature3ExpertFeatureEnable = False
ExpertFeature4ExpertFeatureAccessKey = 0
ExpertFeature4ExpertFeatureEnable = False
ExpertFeature5ExpertFeatureAccessKey = 0
ExpertFeature5ExpertFeatureEnable = False
ExpertFeature6ExpertFeatureAccessKey = 0
ExpertFeature6ExpertFeatureEnable = False
ExpertFeature7ExpertFeatureAccessKey = 0
ExpertFeature7ExpertFeatureEnable = False
ExposureAuto = Off
ExposureMode = Timed
ExposureTimeAbs = 5000
ExposureTimeRaw = 5000
FeatureSet = Full
FileOpenMode = Read
FrameStartTriggerActivation = RisingEdge
FrameStartTriggerDelayAbs = 0
FrameStartTriggerMode = Off
FrameStartTriggerSource = Line1
GainAuto = Off
GainRemoveLimits = False
Gamma = 1
GammaEnable = False
GammaSelector = User
GrayValueAdjustmentDampingAbs = 0.68359
GrayValueAdjustmentDampingRaw = 700
LastError = InvalidParameter
Line1LineDebouncerTimeAbs = 10
Line1LineFormat = OptoCoupled
Line1LineInverter = False
Line1LineMode = Input
Line1LineStatus = False
Line1MinOutPulseWidthAbs = 0
LineLogic = Negative
LineStatusAll = 0
Out1LineDebouncerTimeAbs = 0
Out1LineFormat = OptoCoupled
Out1LineInverter = False
Out1LineMode = Output
Out1LineSource = UserOutput
Out1LineStatus = False
Out1MinOutPulseWidthAbs = 0
PacketDelay = 0
PacketSize = 2000
PixelColorFilter = None
PixelDynamicRangeMax = 255
PixelDynamicRangeMin = 0
ReadoutTimeAbs = 14762
ResultingFramePeriodAbs = 19810
ResultingFrameRateAbs = 50.4796
ReverseX = False
SequenceAdvanceMode = Auto
SequenceCurrentSet = 0
SequenceEnable = False
SequenceSetExecutions = 1
SequenceSetIndex = 0
SequenceSetTotalNumber = 2
ShutterMode = Global
SyncUserOutput1SyncUserOutputValue = False
SyncUserOutputValueAll = 0
TestImageSelector = Off
TimestampTickFrequency = 125000000
UserOutput1UserOutputValue = False
UserOutputValueAll = 0
Value1UserDefinedValue = 0
Value2UserDefinedValue = 0
Value3UserDefinedValue = 0
Value4UserDefinedValue = 0
Value5UserDefinedValue = 0
VendorDefectPixelCorr = False</pre>Iris/matlabcentral/answers/contributors/5088092iristag:mathworks.com,2005:Question/15303720140901T08:32:12Z20140901T10:32:41Zhow to process many sequential data using for loop <p>I have 40 sequential data in my Workspace, and I would like to process each of all the 40 using a for loop.</p><p>the data is named like this...</p><p>trail</p><p>trail1</p><p>trial2</p><p>trial3</p><p>....</p><p>trial39</p><p>this is my code, but not working...</p><p>% Select each of the 40 trials</p><p>for e = 1:40</p><pre> data = trial'e'; </pre><p>end;</p><p>so i need to process 'data' in each loop</p><p>thank you.</p>wasiu/matlabcentral/answers/contributors/5576243wasiutag:mathworks.com,2005:Question/12993420140516T23:02:37Z20140901T10:27:26ZCan I import history.m from 2013 to History.xml in 2014a?<p>Why OH why does Mathworks changes things that worked great in one version  I hate their new releases and the changes that simply frustrates how one is used to doing things.</p><p>For several releases now, I always copied my previous release's "history.m" file into the appropriate directory and I could go on with what I had done. Come 2014a, they decided to make the history into an XML file and I am now grinding my teeth in frustration, because I cannot simply use the up arrow and go with what I was doing before I updated to the new release. I have to keep the old history file open and copy and paste from there. I had my history set to 50,000, so I remembered some years of commands. Very helpful when I want to remember the set of commands I used on a specific day in the past.</p><p>Mathworks  your ribbon interface was a bad idea, now this history is a bad idea. Maybe it is time to abandon Matlab and find an alternate....</p>Matlab Challenged/matlabcentral/answers/contributors/62281matlabchallengedtag:mathworks.com,2005:Question/15304420140901T09:46:59Z20140901T10:23:04Zwhy the mean value of a unit pulse is zero<p>Mean value of a unit pulse is zero ?</p>MANJUNATH/matlabcentral/answers/contributors/3243248manjunathtag:mathworks.com,2005:Question/15304320140901T09:30:38Z20140901T09:55:25ZError : Undefined variable "uiscopes" or class "uiscopes.getDefaultPosition"  standalone application<p>Currently, I'm building a standalone Windows application using Matlab Compiler. While the GUI matlab code runs perfectly within Matlab, the compiled standalone application doesn't work and gives an error  <i>Undefined variable "uiscopes" or class "uiscopes.getDefaultPosition"</i>.</p><p>In my Matlab code, I create a Spectrogram scope window using dsp.SpectrumAnalyzer. Without dsp.SpectrumAnalyzer, the standalone application is executed well without any problem although there is no spectrogram scope window.</p><p>My matlab version is 2014a. How can I run the standalone application without the error?</p>IKJOO/matlabcentral/answers/contributors/2106018ikjootag:mathworks.com,2005:Question/15302620140901T04:42:16Z20140901T09:37:06Zhow we can represent an image in graph in matlab?<p>i need get the data from the images like those from the remote sensed image let me know that if there is any way in matlab to represent the image in graph</p>Christina/matlabcentral/answers/contributors/5431512christinatag:mathworks.com,2005:Question/15303220140901T07:34:05Z20140901T09:36:34ZCan I find the program associated with a .exe file?<p>I have an application called BeLT that logs the keystrokes and mouse actions.It also saves the name of the .exe file related to the programs that have been executed,for example "chrome.exe" for "google chrome".</p><p>I need to find the application related to any .exe file stored. For example if I have "chrome.exe" then I find the program associated with this exe file i.e. google chrome.</p><p>Is there anyway to do that using a matlab code or any other code or toolbox that can be linked to a matlab code? E.g. I may need a conncetion from my code to the internet and a search engine to find the program associated with the .exe filename.</p><p>Thanks</p>Mohammad Reza/matlabcentral/answers/contributors/4959359mohammadrezatag:mathworks.com,2005:Question/13354020140610T13:43:57Z20140901T09:36:07ZSymbolic Output Display Problem<p>I have a long symbolic expression where the output display gives unwanted fraction representations. An example of the output is given below. The unwanted fraction is given in bold. I've attached the m.file used to generate the output. You can see that this fraction is not contained in the input definition of c111r. I have tried various commands such as "sym(5^(1/2))" to prevent this from happening without success. Any help would be greatly appreciated. I am using MatlabR2013b.</p><pre class="languagematlab">c111r =
</pre><pre class="languagematlab">(((((c11 + c12)/((c11  c12)*(c11 + 2*c12))  1/(2*c44) + c12/((c11  c12)*(c11 + 2*c12)))*((16*2^(1/2)*pi^2*W400)/35 + (16*5^(1/2)*pi^2*W420)/35  1/5) + c12/((c11  c12)*(c11 + 2*c12)))*(((c11 + c12)/((c11  c12)*(c11 + 2*c12))  1/(2*c44) + c12/((c11  c12)*(c11 + 2*c12)))*((16*5^(1/2)*pi^2*W420)/35  (16*2^(1/2)*pi^2*W400)/35 + 1/5)  c12/((c11  c12)*(c11 + 2*c12))) + (((c11 + c12)/((c11  c12)*(c11 + 2*c12))  1/(2*c44) + c12/((c11  c12)*(c11 + 2*c12)))*((4*2^(1/2)*pi^2*W400)/35  (8*35^(1/2)*pi^2*W440)/35 + 1/5)  c12/((c11  c12)*(c11 + 2*c12)))*(1/(2*c44) + ((32*2^(1/2)*pi^2*W400)/35 + 3/5)*((c11 + c12)/((c11  c12)*(c11 + 2*c12))  1/(2*c44) + c12/((c11  c12)*(c11 + 2*c12)))  c12/((c11  c12)*(c11 + 2*c12))))^3*(((3*c144*(c11 + c12))/((c11  c12)*(c11 + 2*c12))  (6*c12*c155)/((c11  c12)*(c11 + 2*c12)))/(2*c44^2)  c112*((6*c12^3)/((c11  c12)^3*(c11 + 2*c12)^3) + (6*c12*(c11 + c12)^2)/((c11  c12)^3*(c11 + 2*c12)^3)  (6*c12^2*(c11 + c12))/((c11  c12)^3*(c11 + 2*c12)^3))  (((c144*(c11 + c12))/((c11  c12)*(c11 + 2*c12))  (2*c12*c155)/((c11  c12)*(c11 + 2*c12)))/(4*c44^2)  (c155*((c11 + c12)/((c11  c12)*(c11 + 2*c12))  c12/((c11  c12)*(c11 + 2*c12)))  (c12*c144)/((c11  c12)*(c11 + 2*c12)))/(4*c44^2) + c456/(4*c44^3))* *((269741649381513*pi^2*W420)/21990232555520 + (2497842628749521*pi^2*W440)/153931627888640* +...
</pre>Christopher Kube/matlabcentral/answers/contributors/2610484christopherkubetag:mathworks.com,2005:Question/13487620140617T12:59:24Z20140901T09:29:17ZMUPAD plot multiple points<p>I know its a basic question but i am stuck and could not find the answer yet:</p><p>How to plot multiple points?
In Matlab if i have a vector (e.g.</p><pre class="languagematlab">r = 2:6
</pre><p>), they all can be plotted by</p><pre class="languagematlab">plot(3,r)
</pre><p>In Mupad, plot(3,r) does not work... What is the correct syntax?</p>thomas mann/matlabcentral/answers/contributors/2427211thomasmanntag:mathworks.com,2005:Question/15303820140901T08:44:16Z20140901T09:24:13Zerror dialog when timeout occurs<p>hi</p><p>In my GUI application, its a single channel acquisition from serial port of a instrument using NI daq card in this way..</p><p>fopen(s); %%% open the serial port oject</p><p>start(ai); %%analog input object.
wait(ai,10); %%%wait for 10 second for data to acquire..</p><p>data=getdata(ai,2000); %%no. of samples to acquire 2000
stop(ai);</p><p>fclose(s); %%%close the serial port object s
delete (s);
clear (ai)
delete(ai)</p><p>I want to create a error dialog when timeout occurs i.e. signal doesn't come within the wait time(10 seconds). and it sould close the serial port and clear the ai object for the next acquisition.</p><p>how can I do this.. please help me.</p><p>Thank You.</p>u/matlabcentral/answers/contributors/3243944utag:mathworks.com,2005:Question/15301520140901T01:07:23Z20140901T09:23:05Z I get an error, could you guys help me to figure out?<p>Error using bsxfun
Out of memory. Type HELP MEMORY for your options.</p><p>Error in classreg.learning.internal.wnanmean (line 12)
X = bsxfun(@times,X,W);</p><p>Error in pca (line 284)
mu = classreg.learning.internal.wnanmean(x, vWeights);</p><p>Error in princomp (line 29)
[varargout{1:nargout}]=pca(varargin{1},'Algorithm','svd','Economy',fEconomy);</p><p>Error in pca_for_Zhen (line 36)
[coeff, score, latent]=princomp(data,'econ');</p><p>[fname pname]=uigetfile('*.*','Please click any image in your folder');
cd(pname);
filenamelist=dir(pwd);
nel=length(filenamelist);
index=0;
sampleImage=im2double(imread(fname));
vsampleImage=sampleImage(:);
[numRows numCols]=size(sampleImage);
data=zeros(size(vsampleImage,1),200);
label='Zhen sample';</p><p>for i=3:1:102
if filenamelist(i).isdir~=1
if mod(i,1)==0
index=index+1
fname=filenamelist(i).name;
tempData=im2double(imread(fname));
data(:,index)=tempData(:);
end
end
end</p><p>[coeff, score, latent]=princomp(data,'econ');
n=score>=0;
posscore=n.*score;
m=score<=0;
negscore=m.*score;</p><p>figure</p><p>for j=1:9
subplot(3,3,j)
pcolor(reshape(score(:,j),numRows,numCols));axis image;shading flat;axis ij;
text(5,20,[label ' ' sprintf('%d',j)],'Color','w','FontWeight','bold')
axis off;
colormap jet;
end
cd('..');</p><p>impos(:,:,1)=reshape(posscore(:,2),numRows,numCols);
impos(:,:,2)=reshape(posscore(:,3),numRows,numCols);
impos(:,:,3)=reshape(posscore(:,4),numRows,numCols);
for k=1:3</p><pre> impos(:,:,k)=impos(:,:,k)/max(max(impos(:,:,k)));
end
figure
image(impos);
axis image;
title([label ' Positive']);</pre><p>imneg=zeros(numRows,numCols);</p><p>imneg(:,:,1)=reshape(negscore(:,2),numRows,numCols);
imneg(:,:,2)=reshape(negscore(:,3),numRows,numCols);
imneg(:,:,3)=reshape(negscore(:,4),numRows,numCols);
for k=1:3</p><pre> imneg(:,:,k)=imneg(:,:,k)/max(max(imneg(:,:,k)));
end
figure
image(imneg);
axis image;
title([label ' Negative']);</pre><p>imoverlay=zeros(numRows,numCols);
for k=1:3</p><p>imoverlay(:,:,k)=impos(:,:,k)+imneg(:,:,k);
imoverlay(:,:,k)=imoverlay(:,:,k)/max(max(imoverlay(:,:,k)));</p><p>end
figure
image(imoverlay);
axis image;
title([label ' Overlay']);</p>Zhen Weng/matlabcentral/answers/contributors/5493344zhenwengtag:mathworks.com,2005:Question/15280520140829T20:58:07Z20140901T09:19:10Zwhat called this method of generation random sample<pre> Hi all </pre><p>is the code below represent inverse cdf method?</p><p>y is pdf of any distribution</p><p>cdf_y = cumsum(y);</p><p>sum_y = sum(y);</p><p>for j = 1:N</p><p>randx = sum_y*rand();</p><p>i = 1;</p><p>while cdf_y(i) < randx</p><p>i = i + 1;</p><p>end</p><p>f(j) = x(i);
end</p><p>please give me explain</p>mutah/matlabcentral/answers/contributors/3452108mutahtag:mathworks.com,2005:Question/15304220140901T09:15:13Z20140901T09:15:13ZHow to make sure that matlab answer in command window is copied to text file in two distinct columns(in exactly the same way as a mirror image of the command window)?<p>A script is made to produce all permutations of vector x with vector y.
so each element of x is assigned to each element of y.
%
function rowpermutation_3 = rowpermutation3(x,y)
bla = 4
for k = 1:1e3
[ix, iy] = find(true(size(y, 1), size(x, 1)));
rowpermutation_3 = [x(ix(:), :), y(iy(:), :)];
rowpermutation_3 = [kron(x, ones(size(y,1),1)), repmat(y, [size(x, 1), 1])];
rowpermutation_3column1 = rowpermutation_3(:,1);
rowpermutation_3column2 = rowpermutation_3(:,2);
end
fid = fopen('fprintfrowpermutation3.txt','wt');
fprintf(fid, '%d %f\n',[rowpermutation_3column1,rowpermutation_3column2]);
fclose(fid)
end
%
The matlab commandow does produce the desired outcome,which is like this:
1 21
1 22
1 23
1 24
1 25
2 21
2 22
2 23
2 24
2 25
3 21
3 22
3 23
3 24
3 25
4 21
4 22
4 23
4 24
4 25
5 21
5 22
5 23
5 24
5 25
however my text file produces something different:
1 1.000000
1 1.000000
1 2.000000
2 2.000000
2 2.000000
3 3.000000
3 3.000000
3 4.000000
4 4.000000
4 4.000000
5 5.000000
5 5.000000
5 21.000000
22 23.000000
24 25.000000
21 22.000000
23 24.000000
25 21.000000
22 23.000000
24 25.000000
21 22.000000
23 24.000000
25 21.000000
22 23.000000
24 25.000000</p>Antoine van Hirtum/matlabcentral/answers/contributors/2091244antoinevanhirtumtag:mathworks.com,2005:Question/13788720140627T05:00:13Z20140901T09:14:26ZCreating new symbolic identities<p>I have a matrix expression involving three real symbolic variables called x, y, and z, which are three elements of a vector v in R3. It is known that v is constrained to be a unit vector, so that x^2 + y^2 + z^2 is always equal to 1. Is there a way to tell MATLAB about this identity (x^2 + y^2 + z^2 = 1) so that whenever it encounters the expression x^2 + y^2 + z^2, it substitutes a 1 for that expression?</p><p>I tried using subs(S, x^2 + y^2 + z^2, 1), but that doesn't work ... it appears the second argument to a threeargument subs() call has to be a single variable.</p><p>I tried the following trick, inspired by the conversion from Cartesian to Spherical coordinates:</p><pre class="languagematlab">syms a b real;
s1 = subs(S, x, cos(a) * sin(b));
s2 = subs(s1, y, sin(a) * sin(b));
s3 = subs(s2, z, cos(b));
</pre><p>and that actually performs the x^2 + y^2 + z^2 = 1 substitution, but has the unfortunate side effect that all remaining expressions are now in terms of a and b instead of x, y, and z.</p><p>There <b>has</b> to be a way to do this, right? Corallary: I <b>can't</b> be the first person who has wanted something like this, can I?</p>Daniel Lyddy/matlabcentral/answers/contributors/596819daniellyddytag:mathworks.com,2005:Question/11578820140212T03:31:29Z20140901T09:08:41ZMatlab 2013a (Student Version) won't install on Mac OS X Mavericks (10.9.1)<p>I have the latest version of the MacBook Pro with OS X Mavericks installed. I am unable to install the student version of Matlab R2013a, which I purchased from my university. I doubleclick the "InstallForMacOSX" icon on the CD, the icon bounces in my dock for about a minute, then just sits there and nothing happens (the little light underneath indicating that a program is running is not there). When I try clicking the icon on the dock, it disappears and nothing happens. From what I can tell from the site, this version should have no problems on Mavericks. Any idea why this is happening?</p><p>Thanks,
Joe</p>Joseph/matlabcentral/answers/contributors/4967186josephtag:mathworks.com,2005:Question/14155320140712T13:02:08Z20140901T09:03:18ZBig integer and Precision<p>Hi,</p><p>I am trying to work on some problems which deal with really large integers (much larger than intmax('uint64')). How do I deal with such integers in MATLAB? I got some stuffs online based on 'vpa'. Is there any alternative to symbolic toolbox and vpa? Using an easy example, say I am trying to calculate the value of 2^2317. How is it possible to do it?</p><p>And how do I increase the precision of calculation? Say, I am trying to calculate sqrt(3) upto 15 digits precision. How can I do it?</p><p>Thanks :)</p>saima/matlabcentral/answers/contributors/3411668saimatag:mathworks.com,2005:Question/15304120140901T09:02:48Z20140901T09:02:48ZHowto use PID tune for the best results?<p>Hi.
I have designed a system in simulink, which contains the transfer function of the real system and a controller block.a desired temperatue,and a scope, very simple.The real device is a heating device,which will be connected to the mains voltage and I will generate a PWM signal, according to its current temperature,in order to reach to the desired temperature. my question would be, when I am using the PID block from Simulink library, do I have also to include the mains voltage effective value, as a gain, which would be 230/sqrt(2) in the circuit, or not? since the real device would finally work with mains voltage and will receive the gain.
any comment would help,Thanks</p>Sahar/matlabcentral/answers/contributors/3374823sahartag:mathworks.com,2005:Question/14159420140712T21:54:50Z20140901T08:57:53ZHow to use multipart function to find Fourier series coefficients with this program?<p>Hi
I am writing a script to find Fourier series coefficients. Code is given below. In the code, I have function f=x*x defined on interval L to L. However if I have some function defined, say</p><pre class="languagematlab">f(x) = 1 L<=x<0
= 1 0<=x<=L
</pre><p>then, how I can use such function to find Fourier series coefficients? Any ideas?</p><pre class="languagematlab">close all;
clc;
</pre><pre class="languagematlab">syms x k L n
evalin(symengine,'assume(k,Type::Integer)'); %k is treated as integer
f=x*x; %f is the function to find Fourier series
</pre><pre class="languagematlab">a = int(f*cos(k*pi*x/L)/L,x,L,L); %Fourier series coefficient a_n
b = int(f*sin(k*pi*x/L)/L,x,L,L); %Fourier series coefficient b_n
afun=@(f,x,k,L) int(f*cos(k*pi*x/L)/L,x,L,L);
bfun = @(f,x,k,L) int(f*sin(k*pi*x/L)/L,x,L,L);
fs = vpa(afun(f,x,0,L)/2 + symsum(afun(f,x,k,L)*cos(k*pi*x/L) + ... bfun(f,x,k,L)*sin(k*pi*x/L),k,1,3),5); %Partial sum of Fourier series coefficients
</pre><pre class="languagematlab">fs=subs(fs,L,1); %making L=1
fs1=symfun(fs,x); %defining symbolic function fs1 for plotting
</pre><pre class="languagematlab">% disp(a);
% disp(b);
% disp(fs);
</pre><pre class="languagematlab">figure();
ezplot(fs1,[5*pi,5*pi]);
</pre>Amit Kumar/matlabcentral/answers/contributors/3268015amitkumartag:mathworks.com,2005:Question/14171220140714T05:01:00Z20140901T08:54:45ZError, (in expand/bigprod) integer too large in context ?<p>When i test the symbolic math toolbox, get an error as follows</p><p>Error, (in expand/bigprod) integer too large in context</p><p>when try to compute the rank of a large matrix (100 by 100),
does that mean the out of memory or something else?</p>WEILU/matlabcentral/answers/contributors/1556512weilutag:mathworks.com,2005:Question/15300820140831T23:58:30Z20140901T08:43:15Zparfor loop variable classification<p>Hi all,</p><p>I have always had trouble getting parlor loops to work for me, and again I'm having a variable classification issue. The code is for a machine vision program that we are using to detect blobs in multiple behavioral chambers in a video. We would basically like to use a parfor loop to find the blobs in each frame more rapidly. We'll track them across frames later. This way it would seem like if we built a small computer cluster, we could speed up the code a lot. Basically this is what we are trying to do with several of our variables (I've shown only one for an example).</p><pre class="languagematlab">recordAValue = NaN(blobsPerChamber, numberOfChambers, numberOfFrames);
</pre><pre class="languagematlab">parfor g = 1:numberOfFrames
load(frame);
for k = 1:numberOfChambers
findBlobs
for j = 1: blobsPerChamber
recordAValue(j,k,g) = someCalculation;
end
end
end
</pre><p>The error that I would get is that recordAValue cannot be classified. I've looked at the documentation but I still can't make sense of it. The loops all seem independent to me and the matrix recordAValue should be able to be generated one loop at a time.</p><p>Any help is appreciated. Thanks in advance.</p>Quentin/matlabcentral/answers/contributors/5000120quentin