http://de.mathworks.com/matlabcentral/answers/questions.atomMATLAB Answers — New Questions20150129T14:21:11Ztag:de.mathworks.com,2005:Question/17315720150129T14:21:11Z20150129T14:21:11ZIterative loop storing variables<p>So I'm using a 'whileend' loop for a particular code in MATLAB, the particular criterion to end the loop I'm using is such that the value for a variable between the nth iteration and nth1 iteration is a predefined value.</p><p>e.g.</p><p>Inputs for:
variables, constants, etc.</p><p>while: abs(variable 'nth' iteration  variable 'nth1' iteration) >= predefined value</p><p>


MATLAB CODE HERE



ETC.</p><p>end</p><p>I was just wondering how would I perhaps go about scripting it, do I have to store the variable each iteration and bring it back into the next iteration? I'm struggling to see how to do this exactly, I'm not particularly use to loops in MATLAB.</p><p>I would appreciate a push in the right direction!</p><p>Conor.</p>conor meaneyhttp://de.mathworks.com/matlabcentral/profile/authors/3802752conormeaneytag:de.mathworks.com,2005:Question/17315620150129T14:18:17Z20150129T14:19:58Zsir, i want to simulate a bidirectional llc type dual bridge resonant converter with a switching frequency of 100KHZ. for this case, how to implement the parameters of the high frequency transformer in simulation<ul><li><b>s</b> *</li></ul>harika kamreddyhttp://de.mathworks.com/matlabcentral/profile/authors/6118203harikakamreddytag:de.mathworks.com,2005:Question/17315520150129T14:17:22Z20150129T14:17:22ZUsing function handles for inputs<p>So I'm having a problem with my code where I'm supposed to use a function of f (an anonymous function handle) as an input into my function and I'm not really sure how to do that.</p><p>My function is</p><pre class="languagematlab">f=@(phi) (1phi)./((phi.32).^.32)
</pre><p>and I'm not given the value of phi</p><p>so far my function header looks like this:</p><pre class="languagematlab">function [ xr, epsA, Niter ] = secant( f, x0, x1, epsMax )
</pre><p>where f is supposed to be my function, and the other inputs are given values</p><p>If I run the code without defining f I just get eh error "Undefined function 'secant' for input arguments of type 'function_handle'."</p>mmhttp://de.mathworks.com/matlabcentral/profile/authors/4930605mmtag:de.mathworks.com,2005:Question/17302920150129T06:20:53Z20150129T14:14:02ZNAVFIX function and use?<p>I went through the product help and couldn't understand the use of NAVFIX and usage in a code. Can anyone help me out with the same. If "navfix" could be successfully used to locate the point of intersection of lines in mapping application, can this be used for other engineering applications? Also assist me with the proper syntax of use with an example. Thank you in advance.</p>Swaroophttp://de.mathworks.com/matlabcentral/profile/authors/5280256swarooptag:de.mathworks.com,2005:Question/17315320150129T14:11:47Z20150129T14:11:47Zhelp I need matlab code to find two values with their index the closest and maximum value and the closest and minimum value <p>distance = sqrt((xdx(I))^2 +(ydy(I))^2)
help I need matlab code to find two values with their index the closest and maximum value and the closest and minimum value</p>maha ismailhttp://de.mathworks.com/matlabcentral/profile/authors/5774280mahaismailtag:de.mathworks.com,2005:Question/17315220150129T14:07:09Z20150129T14:07:09Zsubplot: combine histogram and cdfplot with 2 different yscales<p>Within a subplot I want to combine histogram and cumulative distribution function (cdfplot):
subplot('Position',[.3 .05 .6 .2])
% a1 = axes('Parent',f);
% h1=histogram(histo,numOfBins,'Normalization','probability','Orientation','vertical');
h1=histogram(histo,numOfBins,'Normalization','probability','Orientation','vertical');
% set(h1,'FaceColor','r')
% set(h1.Parent,'YAxisLocation','left')
hold on
h2=cdfplot(histo);
set(h1.Parent,'YAxisLocation','right')
grid on</p><p>I need two YScales (left: frequency of oberservations, right: cumulative from 0 to 1); otherwise the histogram is hardly visible. I can set one YAxisLocation but not two different ones. Any help appreciated.</p>Romanhttp://de.mathworks.com/matlabcentral/profile/authors/344526romantag:de.mathworks.com,2005:Question/17315120150129T14:06:27Z20150129T14:06:27ZIntelligent algorithm for classification<p>hi everybody.
i need to classify some data using an algorithm such as neural network. but as you know it doesnt accept inf values.does anybody know about an intelligent algorithm for classification which can deal with inf values?
please help me if you can. thank you</p>maryamhttp://de.mathworks.com/matlabcentral/profile/authors/4521399maryamtag:de.mathworks.com,2005:Question/17314920150129T13:35:27Z20150129T14:01:06ZHow to get 2nd minimun value from matrix?<p>I want to get the 2nd minimum number from a matrix. Elements in matrix are random and i don't want to sort them.
for example</p><p>A=[2 6 83 14 29;17 42 31 90 23;17 52 43 81 29;48 11 90 21 58];</p>Zahid Iqbal Ranahttp://de.mathworks.com/matlabcentral/profile/authors/5620382zahidiqbalranatag:de.mathworks.com,2005:Question/17315020150129T13:58:56Z20150129T13:58:56ZI need code for background subtraction to detect foreground example may be car on the roab<p>Code for background subtraction to detect foreground object</p>kavya phttp://de.mathworks.com/matlabcentral/profile/authors/5862437kavyaptag:de.mathworks.com,2005:Question/17314420150129T13:24:09Z20150129T13:40:30Zhow to perform bitwise logical xor for two matrices having 13 bit binary data each?<p>I have two cell arrays with each element having 13 bit binary strings. How to perform bitwise XOR for these two cell arrays.</p><p>For eg: consider two 3x3 cell arrays A and B</p><pre class="languagematlab">A= '1011111111011' '1011111111011' '1011111111011'
'1100000111111' '1100000111111' '1100000111111'
'1100000001000' '1100000001000' '1100000001000'
</pre><pre class="languagematlab">B= '1100001001010' '1100001001010' '1100001001010'
'1011111100010' '1011111100010' '1011111100010'
'1100000001110' '1100000001110' '1100000001110'
</pre><p>My desired output is as below</p><pre> C=A XOR B
ie C(1,1)= '1011111111011' XOR '1100001001010'
C(1,1)= '0111111011001'</pre><p>Similarly for all the elements a bitwise XOR should be performed</p>Abiramihttp://de.mathworks.com/matlabcentral/profile/authors/5514421abiramitag:de.mathworks.com,2005:Question/17212220150127T05:39:13Z20150129T13:38:26ZI need to match following images<p>The following images are edge detected image I need to find precentage of matching</p><p><</m</p><p>>></p>kavya phttp://de.mathworks.com/matlabcentral/profile/authors/5862437kavyaptag:de.mathworks.com,2005:Question/16921920150107T19:27:51Z20150129T13:35:30Zthis is what the code is<p>Result which I getting is full black
Code is as follows</p><pre> I =imread('image.bitmap');
G=rgb2gray(I);
Se=ones(5,5);
Out=imdilate(G,Se);
Out1=imerode(Out,Se);
Out2=imsubtract(Out,Out1);</pre>kavya phttp://de.mathworks.com/matlabcentral/profile/authors/5862437kavyaptag:de.mathworks.com,2005:Question/17314820150129T13:34:21Z20150129T13:34:21ZHow to generate random number and their sum is specific. <p>i want to generate 6 random numbers whose limits are given as a and b. the sum of ramdon numbers must be equal to 283.4.
Please help me regarding this.
I am using the following code but in x total sum of random numbers is not equal to 283.4 and in p upper and lower bounds are not satisfied.</p><p>a(1,1)=50; b(1,1)=250; %bounds on variable 1</p><p>a(1,2)=20; b(1,2)=160; %bounds on variable 2</p><p>a(1,3)=15; b(1,3)=100; %bounds on variable 3</p><p>a(1,4)=10; b(1,4)=70; %bounds on variable 4</p><p>a(1,5)=10; b(1,5)=60; %bounds on variable 5</p><p>a(1,6)=12; b(1,6)=80; %bounds on variable 6</p><p>x=a+(ba).*rand(N,D); %Random generation</p><p>T=x(:,1)+x(:,2)+x(:,3)+x(:,4)+x(:,5)+x(:,6); %total of random generation</p><p>z=[x(:,1)./T(:,1) x(:,2)./T(:,1) x(:,3)./T(:,1) x(:,4)./T(:,1) x(:,5)./T(:,1) x(:,6)./T(:,1)]; % Equlity
constraint</p><p>p= z.*283.4;</p>Zahid Iqbal Ranahttp://de.mathworks.com/matlabcentral/profile/authors/5620382zahidiqbalranatag:de.mathworks.com,2005:Question/17314720150129T13:33:53Z20150129T13:33:53Zalgorith logic behind L1eq_pd<p>Can anybody pls tell me the logic behind L1eq_pd..</p><pre> how it find the solution</pre><p>Thanks in advance</p>Abhishek sadasivanhttp://de.mathworks.com/matlabcentral/profile/authors/2454716abhisheksadasivantag:de.mathworks.com,2005:Question/17314620150129T13:29:05Z20150129T13:29:05ZFinding distribution using histc<p>Following is the data which I have:</p><p>timeD =</p><pre> 0.1002</pre><pre> 0.0992</pre><pre> 0.1001</pre><pre> 0.1003</pre><pre> 0.0992</pre><pre> 0.1002</pre><p>Below is what I want (1st column: timeD & 2nd column: frequency):</p><p>timeD> frequency</p><p>0.0000  0.1000 > 2,</p><p>0.1000  0.2000 > 4</p><p>I need to draw a distribution graph. (y axis: frequency , x axis: timeD)</p><p>Here is what I have so far:</p><p>A=timeD;</p><p>binranges=0.0000:0.1000:0.2000;</p><p>[bincounts]=histc(A,binranges);</p><p>figure;</p><p>bar(binranges,bincounts,'histc')</p><p>Two questions:</p><p>1)
a) I only want to have 2 bin ranges, such as (0.0000 to 0.1000) and (0.1000 to 0.2000). When I execute this code, the axis goes upto 0.35 instead of 0.2000. Why is that?</p><p>b) I need the bit ranges to be upto 4 decimal places (eg: 0.1000). Is it feasible in MatLab?</p><p>2) Since my goal is to draw a distribution graph I guess I need to plot a” frequency polygon” on the histogram. Does MatLab let you do so? How?</p><p>NOTE: pls see attached files.</p>Chathuhttp://de.mathworks.com/matlabcentral/profile/authors/4838921chathutag:de.mathworks.com,2005:Question/17311920150129T11:51:55Z20150129T13:25:07ZGlobal and local statistics<p>Hello</p><p>I am working on a project that deals with image processing.
My question is what are the global and local image statistics ?</p><p>Thanks in advance.</p>Ineshttp://de.mathworks.com/matlabcentral/profile/authors/2961706inestag:de.mathworks.com,2005:Question/17314520150129T13:25:00Z20150129T13:25:00ZHow to split classes in two and then calculate a percentage of error?<p>I have this code:</p><pre> %% Loading data
load('wine.data');
% first column stores the wine class according to wine.names file
nClass=max(wine(:,1));
%% Getting the mean of each class for the 13 parameters
meanEachClass=arrayfun(@(x) mean( wine( wine(:,1)==x ,2:end) ), 1:nClass,'UniformOutput',false);
%% Now checking the euclidean distance of a sample
% relative to the mean of each class
nSampleToTest=10;
truePositives = zeros(1, nSampleToTest); % Initialize
for i=1:nSampleToTest
% Randomly choosing a sample
sampleNo=randi(size(wine,1));
sample=wine(sampleNo,2:end);
% calculate the Eudlidian distance to each class.
distances=arrayfun(@(x) norm(samplemeanEachClass{x}), 1:nClass, 'UniformOutput',true);
disp(sprintf('Sample #%d',sampleNo))
disp(sprintf('Distance: \n Class 1: %f \n Class 2: %f \n Class 3: %f \n',distances(1),distances(2),distances(3)));
disp(sprintf('Based on distance, Sample seems to belong to class %d\n', find(distances==min(distances))))
disp(sprintf('According to the database, sample belongs to class %d\n',wine(sampleNo,1)))
[~, myClass] = find(distances==min(distances));
trueClass = wine(sampleNo,1);
if myClass == trueClass
% Accurately determined the class.
truePositives(sampleNo) = 1
end
end
overallAccuracyPercentage = 100 * sum(truePositives) / nSampleToTest;</pre><p>Here is the database: <a href = "http://archive.ics.uci.edu/ml/machinelearningdatabases/wine/">http://archive.ics.uci.edu/ml/machinelearningdatabases/wine/</a>
This code calculates the nearest prototype by using the euclidian distance. The problem is here that my train vectors are represented by the all vectors from database and my test vectors are randomly taken. I want to split in 2 each class and the first half to represent the train vectors and the other the test vectors. For example class 1 has 59 vectors: 30 train vectors and 29 test vectors and so on with the class 2 and 3. Then i want to be able to calculate the percentage of error. Can you provide me some code,please?</p>Stefan Olaruhttp://de.mathworks.com/matlabcentral/profile/authors/6093554stefanolarutag:de.mathworks.com,2005:Question/17314320150129T13:23:13Z20150129T13:23:13ZHow to give a standalone path for deployed GUI, because my GUI output is a mat file.?<p>I have created standalone GUI package from 'deploytool > Application Compiler'.My GUI output is a mat file. My GUI application is working fine after deploy,but unable to create the final output mat file at standalone path. What path should I give so that It could create output mat file from deployed app ,when installed at different customer sites.</p>nikhilhttp://de.mathworks.com/matlabcentral/profile/authors/4663555nikhiltag:de.mathworks.com,2005:Question/17314220150129T13:16:17Z20150129T13:16:17ZSimulink scope y axis values not visible<p>Why does simulink scope chop off the digits (most significant) in the y axis if the values have more than 4 digits after the decimal point? Is there a workaround to fix this?</p><p>The y axis of the middle scope in the attached figure illustrates the problem.</p><img src = "/matlabcentral/answers/uploaded_files/24624/Untitled.png">Vivashttp://de.mathworks.com/matlabcentral/profile/authors/4634615vivastag:de.mathworks.com,2005:Question/17312020150129T12:11:18Z20150129T13:15:09ZRemoving NaN from matrix with strings and numbers<p>I'm having trouble removing NaN from this matrix</p><pre> cabos=
[1x26 char] 'Início' 'Fim' [1x20 char] 'N. volt. level [KV]'
[2.0088e+03] 'SE S M Portuzelo' 'PTD 0526' [ 18.6057] [ 15]
[ 169.0442] 'PTC 5452' 'PTD 0450' [ 18.6057] [ 15]
[ 446.3509] 'PTD 0039' 'PTC 2850' [ 18.6057] [ 15]
[ 635.2552] 'PTD 0450' 'PTD 0039' [ 18.6057] [ 15]
[ 255.5464] 'PTD 0450' 'PTD 0090' [ 18.6057] [ 15]
[4.2281e+03] 'PTD 0526' 'PTC 5452' [ 18.6057] [ 15]
[ NaN] [ NaN] [ NaN] [ NaN] [ NaN]
[ NaN] [ NaN] [ NaN] [ NaN] [ NaN]
[ NaN] [ NaN] [ NaN] [ NaN] [ NaN]</pre><p>I tried this code and it removes de NaN values, but it completely rearanges the matrix and i can't solve this</p><pre class="languagematlab">cabos(cellfun(@(cabos) any(isnan(cabos)),cabos)) = []
</pre>Diogo Queiróshttp://de.mathworks.com/matlabcentral/profile/authors/5650135diogoqueirostag:de.mathworks.com,2005:Question/17023920150116T17:37:34Z20150129T13:13:39ZSimulink: How to run simulation in real time<p>I am using the joystick input block from the 3d animation library, and I am using it to control a robot arm imported from solidworks using the simmechanics simscape package. The coordiantes of the end effector are displayed in a simulink display sink block.</p><p>The problem is that the simulation runs much faster than real time, so I puch the joystick up, and the coordiates of the end effector respond imediately, and it would seem like the robot arm had lifted in a fraction of a second, however if you look at the simulation time it has taken about 10 seconds.</p><p>the Mechanics explorer window records the simulation and can play it back in real time, but because it is a recording it is completley out of sinc with my actions on the joystick.</p><p>I need the simulink simulation to run in real time, how do I do this?</p><p>Thanks!</p><p>EDIT:</p><p>I have found a temporary solution. I changed the simulation to fixed step, and then by trial and error changed the value of the step size so the simulation time roughly matches real time. Also, as long as the simulation time is slighlty slower than real time, the mechanics exploer window plays the simulation at its most recent values, so it is completley in sync with the joystick inputs. However, I would still like a propper way to play the simulation in real time as this method isn't perfect.</p>Craighttp://de.mathworks.com/matlabcentral/profile/authors/4918595craigtag:de.mathworks.com,2005:Question/17311820150129T11:35:19Z20150129T12:52:26ZHow to write a paper<p>with patience</p>jinming dinghttp://de.mathworks.com/matlabcentral/profile/authors/6117781jinmingdingtag:de.mathworks.com,2005:Question/17309820150129T10:12:26Z20150129T12:41:11ZI need code for contour extraction of teeth.pls help me out.<p>from dental xrays I need to extract the contours.</p>Priyadharshini umapathy kannanhttp://de.mathworks.com/matlabcentral/profile/authors/6055012priyadharshiniumapathykannantag:de.mathworks.com,2005:Question/17307820150129T08:52:43Z20150129T12:30:30ZI have converted image into 16*16 block. How can i convert these block into video? <p>my code is</p><pre> I=imread(image);
img=rgb2gray(I);
[col, row] = find(img<250);
imout = I(min(col):max(col), min(row):max(row));
imshow(imout);
[rows columns numberOfBands]=size(imout);
blockSizeR = 16;
blockSizeC = 16;
wholeBlockRows = floor(rows / blockSizeR);
wholeBlockCols = floor(columns / blockSizeC);
blockNumber=1;
for row = 1 : blockSizeR : rows
for col = 1 : blockSizeC : columns
row1 = row;
row2 = row1 + blockSizeR  1;
row2 = min(rows, row2);
col1 = col;
col2 = col1 + blockSizeC  1;
col2 = min(columns, col2);
block=imout(row1:row2, col1:col2);
subplot(16,16,blockNumber);
imshow(block);
blockNumber = blockNumber + 1;
end
end</pre>vidya naveenhttp://de.mathworks.com/matlabcentral/profile/authors/6117381vidyanaveentag:de.mathworks.com,2005:Question/17307320150129T08:36:46Z20150129T12:06:28ZCode executes slower after declaring variables with their respective types instead of double type<p>Hello,</p><p>I'm working on a code which can be divided in two parts.</p><p>The first part consists of reading the input files from csvfiles and storing them as variables.</p><p>The second part consists of manipulating those variables in order to get the different results.</p><p>Until recently all the variables were stored as double type. In order to reduce the execution time of the code we decided to store each variable with their most suitable type. For example the age of a person would be a uint8type.</p><p>After I changed the code I made a performance test with a small part of the input files.
Unfortunately, the change did not bring the performance improvement we expected, the change even slowed down the code.</p><pre> All Double Most suited type
Part 1 30s 50s
Part 2 60s 80s
Total 90s 130s</pre><p>This would mean the execution of the code with all the input files would take about 44% more time than previously from 35min runtime to 50 minute runtime.</p><p>Before the change the variables were read with the sscanf function from the csvfiles. The result of the sscanf function is than stored as a double. (Because that's what sscanf does and there is no way to change it?)</p><p>After the change the variables are simply read as a string and then stored with their respective type (With the help of a hashtable, which gives the respective type of every variable).</p><p>Is there an explanation why the execution time of my code increased, even though I changed the datatypes of the variables in order to free up memory space?</p><p>I would specifically like to know why the calculating part (Part 2) of my code has slowed down after the change. Because I did not change this part of the code the only thing that happened is the fact that the variables have different types and take less memory space.</p><p>Thank you very much,</p><p>Luca</p>Lucahttp://de.mathworks.com/matlabcentral/profile/authors/6031786lucatag:de.mathworks.com,2005:Question/17311520150129T11:15:59Z20150129T12:03:55Zerror when reading a bmp picture<p>Hello,</p><p>I try to read the attached picture with imread and to put the RGB values into the variable M</p><pre class="languagematlab">M = imread('test1.bmp');
</pre><p>but I get the following error:</p><pre class="languagematlab">Reference to nonexistent field 'AlphaMask'.
</pre><pre class="languagematlab">Error in readbmpdata>bmpReadData32 (line 285)
rgbaMaskArray = [info.RedMask, info.GreenMask, info.BlueMask,
info.AlphaMask];
</pre><pre class="languagematlab">Error in readbmpdata (line 32)
X = bmpReadData32(info);
</pre><pre class="languagematlab">Error in readbmp (line 17)
X = readbmpdata(info);
</pre><pre class="languagematlab">Error in imread (line 415)
[X, map] = feval(fmt_s.read, filename, extraArgs{:});
</pre><p>Has anyone an idea where the error comes from? Thanks!</p><p>Cheers
Guillaume</p>Guillaumehttp://de.mathworks.com/matlabcentral/profile/authors/5326629guillaumetag:de.mathworks.com,2005:Question/17166920150125T13:59:08Z20150129T11:59:15Zhow can I convert comma with decimal points for a lot of textfiles?<p>Hello,</p><p>I would like to import 10 textfiles which have comma as decimal delimiter.</p><p>All text file look like:</p><p>Time Fn Ft</p><p>0,1 1,2 5,9</p><p>0,2 1,8 9,4</p><p>0,3 1,9 10,8</p><p>Does anyone know how to do import those textfiles and convert comma with decimal points?</p><p>Thank you for your help</p>afryahttp://de.mathworks.com/matlabcentral/profile/authors/4772638afryatag:de.mathworks.com,2005:Question/17276620150128T11:55:27Z20150129T12:15:18Zurlwrite with http authentication<p>Hi,</p><p>I got one problem , that with urlwrite function,can it work for http authentication also? I have checked early some people said: function has a "params" argument, but these are CGIstyle parameters that get encoded in the URL. Authentication is done with lowerlevel HTTP Request parameters.</p><p>Herｅ Ｉ ｆｏｕｎｄ ｔｈａｔ Authentication option in urlwrite.m is ONLY available since Matlab release 2013a. You can check your matlab version by typing ver at the Matlab prompt. With the example</p><pre class="languagematlab">URL = 'http://csa.esac.esa.int/csa/aio/productaction'; fileName=tempname; gzFileName = [fileName '.gz']; [gzFileName,st]=urlwrite(URL,gzFileName, 'Authentication', 'Basic','Get', { 'Username', '<username>', 'password', '<password>', 'DATASET_ID', 'C1_CP_WHI_ELECTRON_DENSITY', 'START_DATE', '20111110T18:00:00Z', 'END_DATE', '20111110T21:00:00Z', 'NON_BROWSER', '1'}); gunzip(gzFileName); fileNames=untar(fileName); for iFile = 1:numel(fileNames), disp(fileNames{iFile}); end
</pre><p>this gives me error all the time. Is this correct parameters?</p>buerhttp://de.mathworks.com/matlabcentral/profile/authors/3174793buertag:de.mathworks.com,2005:Question/17272120150128T08:42:24Z20150129T11:25:28ZI recently installed fixed point designer tool for the version MATLAB R2010b SP2. Upon checking for the tool installation, it shows fixed point tool is included as shown in attachment. But when i simulate my model, it shows error as shown: <img src = "/matlabcentral/answers/uploaded_files/24557/version.jpg"><p>ERROR MESSAGE :
'untitled/Constant' requested use of data type 'sfix16_En14'. Use of this data type requires a fixedpoint license, but license checkout failed. To use this model without a fixedpoint license, select "FixedPoint Tool" under "FixedPoint" from the model's Tools menu. Select the root model in Model Hierarchy. Set "Logging mode" to be "Force off", "Data type override" to be "Double" and "Data type override applies to" to be "All numeric types". This replaces most uses of fixedpoint data types with floatingpoint doubles. In rare cases, a few attempts to use restricted data types may still exist. Reconfiguring to use floatingpoint types and/or inserting Typecasts is necessary in these cases.</p><p>WHAT COULD BE THE POSSIBLE REASON</p>Sachin Prithivirajhttp://de.mathworks.com/matlabcentral/profile/authors/6112802sachinprithivirajtag:de.mathworks.com,2005:Question/17311720150129T11:22:18Z20150129T11:22:18ZHow to add figure copy button to toolbar?<p>Figureのコピーを多用するため，Figureウィンドウからワンボタンで出来るようにしたいと考えています。</p><p>編集 > Figureのコピー</p><p>で出来ることを，既存のFigureのツールバーに追加して，デフォルト設定とすることは出来るでしょうか？
(ツールバーは今以上に増やしたくないので，段をこれ以上追加しない方法を探しています)</p><p>環境:MATLAB R2013b</p>HEhttp://de.mathworks.com/matlabcentral/profile/authors/2954181hetag:de.mathworks.com,2005:Question/17311620150129T11:19:04Z20150129T11:19:45Z"Server Creation Failed" when I run a Prok.Phantom<p>I'm using the ProkPhantom library for Phantom Omni haptic device: <a href = "http://code.google.com/p/prokphantom/downloads/list">http://code.google.com/p/prokphantom/downloads/list</a></p><p>Actually I run it successfully in my 32bit computer with win xp OS, 32bit Matlab. But for now I want to run it with my 64bit computer, win 7 OS.</p><p>For this library, the requirement are:
Windows 2000/XP/7.
Matlab 6.5 or higher (32 bit, no toolboxes required)
Installed Open Haptics Toolkit is required (hd.dll)
(<http://code.google.com/p/prokphantom/>)
which have been met in my case and I am using the 32bit Matlab 2012a.</p><p>But I get the error:</p><p>Error using feval
Server Creation Failed:</p><p>Error in actxserver (line 87)
h=feval(['COM.' convertedProgID], 'server', machinename, interface);</p><p>Error in my>my_OpeningFcn (line 71)
h = actxserver('Prok.Phantom'); % Activate this component</p><p>I have no clue for this problem, anyone can give me any suggestions? Thanks!</p>Shanhttp://de.mathworks.com/matlabcentral/profile/authors/3835824shantag:de.mathworks.com,2005:Question/17277120150128T11:58:12Z20150129T11:10:29ZRemoving spikey data from a sensor readout.<p>I have a loop which reads out a sensor, once in a while the data is completely off, and gives a spike. I would like to remove those spikes.</p><p>The data given moves from 180 to 180 degrees, so when my measurement moves from 180 to 180 this should not be filtered (as this is normal).</p><p>However, if it moves from 180 to 90 then this counts as a spike.</p><p>It's not possible to do data processing after getting every readout, ideally there should be a filter of some sort in the loop itself.</p><p>Any ideas?</p>luchttp://de.mathworks.com/matlabcentral/profile/authors/4279774luctag:de.mathworks.com,2005:Question/17310620150129T11:01:40Z20150129T11:01:40Zmodel and test 2nd order system from desired response, inputs, output and settling time using simulink<p>Hello</p><p>I want model and check following 2nd order system , i dont know the equation or transfer fn, but I know the conditions</p><p>time = 2 to 0 decreasing</p><p>desired output y=100</p><p>settling time = 2</p><p>inputs:</p><p>m= 1</p><p>h= 1</p><p>e= 1</p><p>if any of the input is less then 1 desired output '100' will not be achieved that means it will be less than 100.</p><p>Thanks in advance</p>electrolics inchttp://de.mathworks.com/matlabcentral/profile/authors/3340845electrolicsinctag:de.mathworks.com,2005:Question/17266220150128T06:39:12Z20150129T10:59:06ZI have to access 2 excel files and generate image & do some image processing over that<p>clc
clear
Amp=xlsread('C:\Users\AMIT\Desktop\CB\excel\3\31 amp data.xls');
Th=xlsread('C:\Users\AMIT\Desktop\CB\excel\3\31 thick data.xls');
X=Amp(515:514:131584);
Y=Amp(2:1:514);
Z=Amp(2:1:514,2:1:256);
T=Th(2:1:514,2:1:256);
axes('FontSize',20);
image(Y,X,Z');figure
axes('FontSize',20);
imagesc(Y,X,T');figure</p><p>for i=1:1:513
for j=1:1:255
if ((Z(i,j)>=80) && (Z(i,j)<=90))
A(i,j)=Z(i,j);
B(i,j)=T(i,j);
else
A(i,j)=0;
B(i,j)=0;
end
end
end
axes('FontSize',20);
image(Y,X,A');figure
axes('FontSize',20);
imagesc(Y,X,B');figure
axes('FontSize',20);</p><p>for i=1:1:513
for j=1:1:255
if B(i,j)>=8.0 && B(i,j)<=9.999
A4(i,j)=B(i,j);
else
A4(i,j)=0;
end
end
end
axes('FontSize',20);
imagesc(Y,X,A4');figure</p><p>% Amp (amplitude) is reading an excel file having data varying from 0100
% Th(thick) is reading excel file with data ranging ffrom 0 30
% now i have to check for a certain thickness range various amplitude levels , these data belong to a common trial
% such as for a thickness range of 8.59 mm I have to generate image of amplitude levels 5060,6070 and so on</p>AMIT VERMAhttp://de.mathworks.com/matlabcentral/profile/authors/6075623amitvermatag:de.mathworks.com,2005:Question/17309720150129T10:09:43Z20150129T10:51:29ZExponential Linear Regression fitting model?<p>Hi everyone,</p><p>I'd like to have an help to resolve the following problem,</p><p>I have this relationship Y=b*exp(a/x), I know the values of Y and x, but I need to find the values of a and b.
Can I use the linear regression model (polyfit/polyval)? In case it is possible, how can I use it?</p><p>Thank you,</p><p>Matteo</p>matteohttp://de.mathworks.com/matlabcentral/profile/authors/4801610matteotag:de.mathworks.com,2005:Question/17310320150129T10:49:23Z20150129T10:49:23ZDoes Matlab 2015 support AUTOSAR 4.1.2?<p>Hi,</p><p>i am working at importing arxml 4.1.2 into Simulink. But it seems that Matlab2014b does not support it.</p><p>will matlab 2015 support it? when will 2015 be released?</p><p>thx!</p><p>Min</p>Min Xuhttp://de.mathworks.com/matlabcentral/profile/authors/2914461minxutag:de.mathworks.com,2005:Question/17310220150129T10:41:48Z20150129T10:41:48ZHow do I insert special tick labels onto an axis? <p>I have a vector of years and corresponding depths which I would like to plot in a bar chart.
The years are labelled on the x axis. Say these years are 1800, 1820, 1840, 1860, ...., 1980. The first data point is at 1818. However, I would like to label one special year of 1788 on the xaxis before these automatic labels, with the y values being 0 for each xaxis point until 1818, which is the first one.</p><p>I have added the point (1788,0) to my data set which I am plotting, however I am having trouble adding the label at an appropriate distance relative to all the other labels.</p><p>This is what I have previously tried:</p><p>set(gca, 'xticklabel', {1788, 1800, 1820, 1840, 1860, 1880, 1900, 1920, 1940, 1960, 1980})
However, this gives me the label '1788' on the xaxis at the same spacing as all the other labels, but I want it to be positioned at the appropriate scale.</p><p>I have also tried
With xticksat= [1788] but this doesn't work at all and gives me an error when I try to run the function.</p><p>Does anybody have any suggestions?</p><p>Help would be very much appreciated.</p>Monica Lahttp://de.mathworks.com/matlabcentral/profile/authors/6117629monicalatag:de.mathworks.com,2005:Question/17310120150129T10:29:53Z20150129T10:37:04ZPlot several graphs with differnt sample time in one figure<p>There is several data that I want to plot in one figure, but they are with different sample times, as some are gotten from measurements, while others are gotten from simulations.
Also, some of the relative values may be very different, so I need to show them in different axises, for now I choose <i>plotyy</i> .</p><p>When they are with the same sample time, the code works well, as follows,</p><pre class="languagematlab">x = 0:1:10; % Sample Time is 1000ms
y1 = sin(x); % y1~y5 with the same time
y2 = cos(x);
y3 = 10*sin(x/2);
y4 = 10*cos(x/2);
y5 = x;
%
figure
[handle_DualAxes,handle_line1,handle_line2] = plotyy(x,[y1;y2],x,[y3;y4;y5]);
</pre><p>But when I use this method with different sample times, like</p><pre class="languagematlab">x1 = 0:0.01:10; % Sample Time1 = 10ms
x2 = 0:1:10;% Sample Time2 = 1000ms
y1 = sin(x1);%With sample time1
y2 = sin(x2);%With sample time12
y3 = 10*sin(x1/2);%With sample time1
y4 = 10*sin(x2/2);%With sample time2
y5 = x2;%With sample time2
%
figure
[handle_DualAxes,handle_line1,handle_line2] = plotyy([x1;x2],[y1;y2],[x1;x2;x2],[y3;y4;y5]);
</pre><p>Error message accurs,</p><pre class="languagematlab">??? Error using ==> vertcat
CAT arguments dimensions are not consistent.
Error in ==> Dual_Axes_Try at 47
[handle_DualAxes,handle_line1,handle_line2] =
plotyy([x1;x2],[y1;y2],[x1;x1;x2],[y3;y4;y5]);
</pre><p>How should I use the plotyy here? Or if there is any other way to draw this figure. Thanks.</p>Sihttp://de.mathworks.com/matlabcentral/profile/authors/4913351sitag:de.mathworks.com,2005:Question/16452720141127T14:23:34Z20150129T10:22:55ZJava error when opening fig files<p>When I try to open a .fig I get this error:</p><pre class="languagematlab">Exception in thread "AWTEventQueue0" java.lang.NoClassDefFoundError: Could not initialize class javax.media.opengl.GLProfile
at javax.media.opengl.GLCapabilities.<init>(GLCapabilities.java:84)
at com.mathworks.hg.peer.JavaSceneServerPeer.getCaps(JavaSceneServerPeer.java:147)
at com.mathworks.hg.peer.JavaSceneServerPeer.doCreateCanvas(JavaSceneServerPeer.java:676)
at com.mathworks.hg.peer.JavaSceneServerPeer.access$200(JavaSceneServerPeer.java:50)
at com.mathworks.hg.peer.JavaSceneServerPeer$2.run(JavaSceneServerPeer.java:650)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
</pre><p>Running the line <b>opengl info</b> I get the same message. I've updated the graphic drivers but the problem persists. What could it be?</p><p>thanks!</p>Martinahttp://de.mathworks.com/matlabcentral/profile/authors/5424534martinatag:de.mathworks.com,2005:Question/16199020141109T19:19:01Z20150129T10:22:53ZSimulink Blank Diagnostic Viewer<p>Hi,
I'm using Simulink (verions 2014a) for an assignment, who already purpose me a Simulink script (in version 2011a). After some modifications, I'm trying to launch it, but there are some errors. When I wanted to check the errors via the diagnostic viewer, I have a blank window li
ke that :</p><img src = "/matlabcentral/answers/uploaded_files/20759/Simulink%20%20copie.jpg"><p>How can I solve this bug ?</p><p>Thanks in advance. Thomas</p>Thomashttp://de.mathworks.com/matlabcentral/profile/authors/5878618thomastag:de.mathworks.com,2005:Question/17288620150128T15:28:31Z20150129T10:17:00ZHow can I correct the misplaced lines of this image?<p>Dear Matlab friends</p><p>I am working with some images taken from the brainstem of mice. As you can see below, the lines(rows) of the images have been misplaced (due to a technical problem in the recording set up). I mean the lines need to be shifted to right or left a bit to match each other. You can see it by focusing on the edges of the circle. I need to correct this to get the exact shape of those bright spots and get the highest possible correlation of the pixels. but I do not know how to do it.</p><p>which programming steps should I take?
Are there any known methods for a problem like this?</p><p>please guide me</p><p>thank you all</p><p>payman</p><img src = "/matlabcentral/answers/uploaded_files/24592/ratio.jpg">payman khayreehttp://de.mathworks.com/matlabcentral/profile/authors/4815555paymankhayree