http://mathworks.com/matlabcentral/answers/questions.atomMATLAB Answers — New Questions2014-09-18T15:41:30Ztag:mathworks.com,2005:Question/1553222014-09-18T15:39:13Z2014-09-18T15:39:13ZWrite a loop to draw 50 circles with random positions, and random sizes and random colors.<p>Write a loop to draw 50 circles with random positions, and random sizes and random colors.</p>Attique/matlabcentral/answers/contributors/5642745-attiquetag:mathworks.com,2005:Question/1553072014-09-18T14:07:48Z2014-09-18T15:36:11ZHelp with minimum of a matrix<p>Hello! I have a function which generates a matrix M containing elements. Some of them are infinite (- Inf for example). I need to extract the minimum <b>finite</b> value of M, but if I write min(M) I obtain of course - Inf. What command can I use ?
Thanks</p>aurc89/matlabcentral/answers/contributors/4846083-aurc89tag:mathworks.com,2005:Question/1553182014-09-18T15:19:01Z2014-09-18T15:34:08ZA way to exit out of a function in the code while it is running?<p>I have a function that runs and resets a variable with respect to a few different things, once this variable is set as a string and not a number which it originally is, i wish to exit the function and not carry on to reset the variable further on, is there a way to do this?</p><p>Either a condition to end once that variable is set as a string or a break within the code? Or maybe another command that would stop the function and output the variable there.</p><p>Cheers for the help!</p>Luke/matlabcentral/answers/contributors/5505982-luketag:mathworks.com,2005:Question/1553142014-09-18T14:44:09Z2014-09-18T15:33:10ZWhat happened to the stack option in the workspace browser?<p>Hi,</p><p>I recently upgraded to 2014a from 2012a and for the most part I love the new version, but I'm puzzled by what seems to be a deleted feature. I can no longer find the option to change which workspace I see when in debug mode in a function the "workspace" window (i.e. nested_fcn_2, nested_fcn_1, main_fcn, base), so I can now only view whatever variables are in scope at the current breakpoint. There used to be a "stack" drop down menu that allowed users to accomplish this (as shown here: <a href = "http://matlab.izmiran.ru/help/techdoc/matlab_env/ws_path3.html#29584)">http://matlab.izmiran.ru/help/techdoc/matlab_env/ws_path3.html#29584)</a>, but it seems to have vanished. Does anyone know how to accomplish this?</p><p>Thanks in advance,</p><p>-eric</p>Eric/matlabcentral/answers/contributors/5521388-erictag:mathworks.com,2005:Question/1553172014-09-18T15:17:06Z2014-09-18T15:30:12ZReorder table variables / columns<p>I've created a table from a large csv file using the readtable function.
I want to reorder the variables / columns in this table.</p><p>For example.</p><p>My table's name is CUTable</p><p>It has a variable CUTable.Date which is the date the data was taken
It is currently column 20 in the table.
I want to make it column 2 and shift existing columns 2-19 to 3-20.</p><p>It seems there should be a very easy command to do this which I'm missing, but I can't seem to find it anywhere in the help or these forums. I could, but don't want to "brute force" it (e.g. create a new table, and one-by-one copy the variables from the exiting table to the new table in the order I want, then delete the old table) if avoidable.</p><p>How can I accomplish this?</p>Alan/matlabcentral/answers/contributors/3622143-alantag:mathworks.com,2005:Question/1553212014-09-18T15:29:27Z2014-09-18T15:29:27Zhow can I simulate the propagation of electromagnetic wave in 3D?<p>I have an assignment to sole these problems, but I am not familiar with Matlab at all. Please show me how to simulate
(1) the rotation of the of the original polarization by 90 degree
(2) the generation of left-circularly polarized light
(3)the generation of an elliptically polarized light ray</p><p>Thank you!</p>Hoa Phan/matlabcentral/answers/contributors/5660392-hoa-phantag:mathworks.com,2005:Question/1551962014-09-17T15:54:00Z2014-09-18T15:28:59ZRemove vertical stripping noise<p>Hello,</p><p>The main goal here is to view the concentric circles and measure the distance between them (by cross sectioning using 'improfile'). However, the noise is getting in the way and making the distance estimation very difficult.
I have been trying to remove the vertical stripping noise from the image attached...but couldn't get anywhere...
Any hint what kind of filter would be useful?</p><p>Depending on the result of noise removal I might need to do some object recognition to visualize the circles in a proper way...but that's for later.</p><p>Thanks in advance.
Kind regards,
Ahmad</p>Ahmad Khaled/matlabcentral/answers/contributors/5632537-ahmad-khaledtag:mathworks.com,2005:Question/1553202014-09-18T15:25:53Z2014-09-18T15:25:53Zhow to implement hanning window with 50% overlap<p>Hi there, I am new to matlab and signal processing and I hope someone can put me out of my misery.
I have .wav files and I wish to get the sound pressure level (dB SPL re:1uPa) from these files against frequency components. Can someone check if my code is correct or what I need to do. And very importantly, I need to apply a 'hanning window' with 50% overlap to my data, how do I do that. Thanks very much for the anticipated helpful reply. Below is my code. Cheers.</p><p>% This reads in the .wav file
[data Fs] = wavread('C:wil.wav');
T = 1/Fs; % Sample time
L = length(data(:,1)); % Length of signal
t = (0:L-1)*T; % Time vector
x = data(:,1);
subplot(3,1,1),plot(t,x)
title('Signal')
xlabel('time (Seconds)')</p><p>NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y = fft(x,NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2+1);</p><p>% Plot single-sided amplitude spectrum.
subplot(3,1,2),plot(f,2*abs((Y(1:NFFT/2+1))))
title('Magnitude of FFT')
xlabel('Frequency (Hz)')
ylabel('Amplitude')
xlim([0 10000]);</p><p>% Plot FFT in dB
subplot(3,1,3),plot(f,-10*(log10(abs((Y(1:NFFT/2+1)).^2))))
title('FFT in dB')
xlabel('Frequency (Hz)')
ylabel('Amplitude (dB)')
xlim([0 1000]);</p>Wil/matlabcentral/answers/contributors/5660193-wiltag:mathworks.com,2005:Question/1553112014-09-18T14:26:41Z2014-09-18T15:23:19ZHow can i divide an image into Overlapping Blocks without using for loop?<p>Hi all,
Lets suppose i have an image of size 64x48, i want to divide it into blocks of size 4x4 (or any size) with an overlap of 1 (or any size less than 4 incase of 4). I tried to read blockproc, but one they need some function to be applied on it which i don't have currently, and second they don't give option of overlapping.</p><p>How can i do that?</p><p>THanks in advance.</p>ihsan/matlabcentral/answers/contributors/3376985-ihsantag:mathworks.com,2005:Question/1553192014-09-18T15:20:09Z2014-09-18T15:20:09ZDiagnostic Viewer hangs with big models in R2014a<p>Anybody else have the Diagnostic Viewer completely hang up in R2014A?</p><img src = "/matlabcentral/answers/uploaded_files/18297/MATLAB_Error.PNG"><p>Happens mostly during model updates or builds with big models.</p><p>Showing on 2 different PCs, one on WinXP, one on Win7.</p><p>Doesn't matter if you stop the script or not - the viewer is hung, and the little blue spinning flower petals just keep spinning for ever.</p><p>After the error, the diagnostic window is stuck and cannot be used anymore until you restart the MATLAB session, or perhaps if you close and open the model again.</p><p>If the error happens during builds, the build itself still completes and the core Simulink functionality is still okay. Its just the diagnostic viewer which is hung.</p>Andrew Roscoe/matlabcentral/answers/contributors/391499-andrew-roscoetag:mathworks.com,2005:Question/1553162014-09-18T14:59:17Z2014-09-18T15:17:28Zmultiple scatter plots with different sizes<p>Please how can want I do a scatter plot of data in A,B,C,D on the same graph where A and B have same sizes and C and D have same sizes but different from the sizes of A and B.
Thanks.</p>Omowunmi/matlabcentral/answers/contributors/3793313-omowunmitag:mathworks.com,2005:Question/1552892014-09-18T12:46:01Z2014-09-18T15:12:50ZMultiplying rows of matrix without bsxfun or for loops<p>I have two matrices A and B generated as follows:</p><pre> x = 2;
y = 4; </pre><pre> A = kron(eye(x), ones(1,y));
littleB = horzcat(zeros(y-1,1),eye(y-1));
B = repmat(littleB, [1,x]);</pre><p>I now want to multiply (element-wise) each row of A with each row of B to get a matrix output like:</p><pre> 0 1 0 0 0 0 0 0
0 0 1 0 0 0 0 0
0 0 0 1 0 0 0 0
0 0 0 0 0 1 0 0
0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 1</pre><p>I want to avoid the use of for-loops. I tried to use bsxfun but get an error (Non-singleton dimensions of the two input arrays must match each other), which I understand is caused by the fact that A has two rows (if A was just one row this would work).
What would be the best way to achieve what I am trying to do?
Any help would be much appreciated.</p>Krunal/matlabcentral/answers/contributors/5559434-krunaltag:mathworks.com,2005:Question/1552572014-09-18T08:03:45Z2014-09-18T15:10:08ZClearing a subplot array of images on a canvas of GUI<p>Hello. I am plotting a set of images whilst in a loop using subplot and its position vector method. In my loop, the values of x and y change. This all works fine and plots to the canvas in my GUI.</p><pre class="language-matlab">positionVector = [os+x, y, width, 0.05];
subplot('Position',positionVector);
hold off;
</pre><p>Does anyone know how to clear this array of images on the canvas??</p><p>Thanks
Jason</p>Jason/matlabcentral/answers/contributors/1217570-jasontag:mathworks.com,2005:Question/1548772014-09-15T12:41:16Z2014-09-18T15:07:46Zhow to plot a 10*10 grid map and how to number the grid cells? (sample pic is attached here)<p>guys, i am in learning phase of matlab. Dont know how to do plot this type of grid?i knew plotting simple grids, but this one made me mad.Is it possible to make this kind of one ?here i attached the model of the grid.
thanks guys</p>dinesh tce/matlabcentral/answers/contributors/5475873-dinesh-tcetag:mathworks.com,2005:Question/1553132014-09-18T14:34:53Z2014-09-18T15:06:55ZHow can I use tblwrite in Matlab<p>I have data which are as the following :</p><pre class="language-matlab">rownames11{kk}=char(rownames1(1,j))----1x225
colnames11={'K_minus_t';'K_minus_d';'a';'b';'c';'Err'}----1X6
values11{kk}}=[K_minus_t(j) K_minus_d(l) c resnorm]------1x225 ( variabe C contain three Values)
end
end
tblwrite(values11,colnames11,rownames11,'functionfitting.txt')
</pre><p>I tried to put these data as table type txt files by using tblwrite when I implement the code I receive this massage:</p><p>Error using tblwrite (line 64) Number of case names must equal number of data rows.</p><p>Error in lamm (line 96) tblwrite(values11,colnames11,rownames11,'functionfitting.txt');</p><p>Any help would be greatly appreciated. I will be grateful to you.</p>Ahmed/matlabcentral/answers/contributors/5528887-ahmedtag:mathworks.com,2005:Question/1552912014-09-18T12:49:09Z2014-09-18T15:00:19Zhow to use image in exterma mfile?<p>i download an mfile named exterma from here,which finds exterma points in an image, <a href = "http://www.mathworks.com/matlabcentral/fileexchange/12275-extrema-m--extrema2-m/content/extrema/extrema.m">http://www.mathworks.com/matlabcentral/fileexchange/12275-extrema-m--extrema2-m/content/extrema/extrema.m</a>
and <a href = "http://www.mathworks.com/matlabcentral/fileexchange/12275-extrema-m--extrema2-m/content/extrema/extrema2.m">http://www.mathworks.com/matlabcentral/fileexchange/12275-extrema-m--extrema2-m/content/extrema/extrema2.m</a>
when I put my image address instead of xy,it gives me the error:(Undefined function 'extrema' for input arguments of type 'uint8'.)
I don't know how to locate my image in this mfile,i just write these 2 lines:
m=imread('image adress.jpg');
xy=rgb2gray(m);
I also find 2 other mfiles here which detect exrema points in an image,but they only give me hundreds of 0 and 1,i want to detect exterma point in my image,show an image for result. <a href = "http://www.mathworks.com/matlabcentral/fileexchange/45338-findextrema/content/findExtrema.m">http://www.mathworks.com/matlabcentral/fileexchange/45338-findextrema/content/findExtrema.m</a></p><p><a href = "http://www.mathworks.com/matlabcentral/fileexchange/41955-find-image-extrema">http://www.mathworks.com/matlabcentral/fileexchange/41955-find-image-extrema</a>
isn't it better to use hit or miss for detecting exterma points?i want to detect top left,right top.... and for each one change the proper strel.?</p>sara/matlabcentral/answers/contributors/5422132-saratag:mathworks.com,2005:Question/1552632014-09-18T09:09:43Z2014-09-18T14:54:58ZHow do i make 3d plot movie<p>I have a matrix of a few points (X,Y,Z) of an object that moves.
I know how to make the plot3 but I want to show it in a conference and to make the graph draw itself in live.
How can I do it easily? (I only know the basics of matlab...)</p><p>The code:
body_pts=uiimport;
figure; plot3(body_pts.data(:,1),body_pts.data(:,2),body_pts.data(:,3),'g');
hold on; plot3(body_pts.data(:,4),body_pts.data(:,5),body_pts.data(:,6),'r');
plot3(body_pts.data(:,7),body_pts.data(:,8),body_pts.data(:,9) ,'g');
plot3(body_pts.data(:,10),body_pts.data(:,11),body_pts.data(:,12) ,'k');
plot3(body_pts.data(:,13),body_pts.data(:,14),body_pts.data(:,15) ,'m');
plot3(body_pts.data(:,34),body_pts.data(:,35),body_pts.data(:,36));</p><p>box on;
grid on;
axis equal;
title('mouth in blue, neck in red, abdorax in green, right eye in black, left eye in magneta, stick in yellow');</p>Ziv Kassner/matlabcentral/answers/contributors/4713434-ziv-kassnertag:mathworks.com,2005:Question/1545542014-09-12T16:40:17Z2014-09-18T14:50:40ZUsing fminunc with a summation<p>Hello,</p><p>I am trying to minimize this objective function f = Σ|(sqrt(a(i,1)-b(1)).^2+(a(i,2)-b(2)).^2+(a(i,3)-b(3)).^2)-r|.</p><p>where I am attempting to find the value for b which minimizes the function and i = 1:n. I am using fminunc but I am unsure of how to pass the summation to it in a valid way. Any advice would be greatly appreciated.</p>Nila/matlabcentral/answers/contributors/5633287-nilatag:mathworks.com,2005:Question/1553152014-09-18T14:45:53Z2014-09-18T14:45:53ZPackage orientation and simple robotic arm<p>Hi everyone, I'm putting an effort into this problem:
I have a conveyor belt where packages run. I should identify the orientation of these packages in order to give instruction to a robotic arm for the correct picking up of these packages.
Anyone could help me? With code or also logical solution?
Thanks a ton, Paolo</p>furlanp/matlabcentral/answers/contributors/5409145-furlanptag:mathworks.com,2005:Question/1302082014-05-19T16:24:14Z2014-09-18T14:44:11ZR2014a windows 8.1 64bit setup.exe doesn't install matlab<p>I just downloaded R2014a 64bit for my Win8.1 laptop. I get the .exe which unzips itself into _temp_matlab_R2014a_win64</p><p>I go into this folder and run setup.exe.</p><p>It proceeds to do the Microsoft C++ Redistributable thing and then nothing. The window just closes and then nothing happens. No error, nothing. I've checked for a background process, run as an admin and moved the folder out of downloads.</p><p>The instructions say that I need to log into the installer with my mathworks id and such, but it doesn't get to that point.</p><p>Thanks in advance for any help/advice. I need this for a project so semiurgent.</p>Gerald/matlabcentral/answers/contributors/5340885-geraldtag:mathworks.com,2005:Question/1551992014-09-17T16:21:15Z2014-09-18T14:39:46Zstepwise regression: Undefined function ' stepwiselm' for input arguments of type 'cell'.<p>I have one .txt file and converted to first a table Ta(Ta=readtable（'xxx.txt'）) then an array Aa（Aa=table2array(Ta)）, the .txt file contains 220 rows and 12 cols, but the table and the array only have 219 rows and 1 col. Where did I do wrong?</p><p>Then when I tried to do stepwise regression I got error message:
Undefined function ' stepwiselm' for input arguments of type 'cell'.</p><p>My coad was:
mdl=stepwiselm(Aa)</p><p>In the .txt file, the first raw are texts e.g. elevation, hight, yields etc. I though I could use these names to define Predictor variables and Response variable. But since these names are lost in Aa, how should I write code for stepwise regression?</p>Yaojiayin/matlabcentral/answers/contributors/5643032-yaojiayintag:mathworks.com,2005:Question/1553122014-09-18T14:33:12Z2014-09-18T14:33:40Zhow can i detect exterma corners in an image?<p>I want to detect exterma corners in an image,like the picture I attached,top left,right top,top right,...should I use hit-miss or any better way?</p><img src = "/matlabcentral/answers/uploaded_files/18296/extrma.bmp">sara/matlabcentral/answers/contributors/5422132-saratag:mathworks.com,2005:Question/1552992014-09-18T13:39:11Z2014-09-18T14:33:01ZHow to extract column data from a csv file in vectors<p>Hello,
I have csv files, here the data are similar to the extract of a file attached as an example. I want to extract the data of some of the columns in vectors and if there are empty values to be completed by NaN. I use the following code, but it needs modification to do what I need. How should I modify the code? thanks-k.</p><pre> fileID = fopen('EXTRAC1985.csv')</pre><pre> C=textscan(fileID,'%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s','delimiter',',','EmptyValue',NaN);</pre><pre> fclose(fileID)
dat1= C{1}(3:end)
dat2= C{10}(3:end)</pre><p>the output is like:
dat2 =</p><pre> '9'
''
'9'
''
'9'
''
'9'
''
'10' etc</pre>Katerina F/matlabcentral/answers/contributors/3651417-katerina-ftag:mathworks.com,2005:Question/1552622014-09-18T09:00:40Z2014-09-18T14:32:30ZHow to specify limits for lsqnonlin<p>I would like to specify that variables in my lsqnonlin fit are real. The other vectors in my problem are complex so I cannot use a fully real solver.</p><p>My function has the following form. r and theta are real-valued coordinate matrices. Intensity is a complex valued matrix. p is the real-valued and positive vector (at least that is what I want to specify). Hej is the function to be minimized.</p><pre class="language-matlab">Hej= @(p)(p(1)*besselj(1,p(2)*r)+(p(4)*besselj(1,p(6)*r).*cos(theta+p(8))+p(9)*besselj(1,p(6)*r).*sin(theta+p(8)))*exp(1i*p(5))).*(r/a<=1) ...
+ (p(1)*besselj(1, p(2)*a)/besselk(1, p(3)*a)*besselk(1,p(3)*r)+...
(p(4)*besselj(1, p(6)*a)/besselk(1, p(7)*a).*cos(theta+p(8))+p(9)*besselj(1, p(6)*a)/besselk(1, p(7)*a).*sin(theta+p(8))).*exp(1i*p(5))).*(r/a>1)...
-Intensity;
</pre><pre class="language-matlab">opts = optimoptions(@lsqnonlin,'DiffMaxChange', 0.1,'FinDiffType', 'central', 'Display','off','MaxFunEvals',2E7,'TolFun',1E-18,'TolX',1E-24,'MaxIter',4E3);
x0 = st; % arbitrary initial guess
lb = 0.0*ones(size(st));
[p_estimated,resnorm,residuals,exitflag,output] = lsqnonlin(Hej,x0, lb,[], opts);
</pre><p>The initial guess is given as real-valued and positive vector.</p><p>So how do I specify that the only valid solution are positive and realvalued?</p>Stine Larsen/matlabcentral/answers/contributors/3508938-stine-larsentag:mathworks.com,2005:Question/1552952014-09-18T13:14:51Z2014-09-18T14:25:25Zblp api undefined function or variable R2010a<p>present in the STATIC JAVA PATH:
javaclasspath()</p><p>C:\Program Files (x86)\blp\API\APIv3\JavaAPI\v3.7.1.1\lib\blpapi3.jar</p><p>when typing: c = blp in MATLAB 7.10.0 (R2010a)
I get: ??? Undefined function or variable 'blp'</p><p>how come the class is not downloaded?</p><p>Many thanks,</p>Nicolas/matlabcentral/answers/contributors/5057192-nicolastag:mathworks.com,2005:Question/977202009-07-07T19:09:00Z2014-09-18T14:21:03ZHow do I change the Temporary Directory that MATLAB uses?<p>By default, MATLAB writes temporary files to /tmp/ on a LINUX system and the C:\Temp folder on a Windows System.</p><p>How can the MATLAB temporary directory be set to a different value? Can this be done at the system level, or by individual users in their MATLAB sessions?</p>MathWorks Support Team/matlabcentral/answers/contributors/4622813-mathworks-support-teamtag:mathworks.com,2005:Question/1553102014-09-18T14:20:52Z2014-09-18T14:20:52ZIncorrect inliers selected by findFundamentalMatrix<p>I'm using findFundamentalMatrix function to geometrically verify the matches detected by a SIFT based matching system (vlfeat). However, it selects matches that match one point in the one of the images to a large number of points in the other image. For example, the following "inlier" matches were returned by the function:</p><img src = "http://www.andrew.cmu.edu/user/rgirdhar/projects/001_Matching/results/0001_BoW/bow_matches/res/Adina_Apartment_Berlin_clean/adina-apartment-hotel_013/sheraton-lax-airport_002_matches.jpg"><p>As far as I understand, F constrains the matches of a point to lie on the epipolar line for that point. It should not give so many random matches for a single point.
Can someone clarify what's happening here?</p>Rohit/matlabcentral/answers/contributors/5659999-rohittag:mathworks.com,2005:Question/1553042014-09-18T13:52:37Z2014-09-18T14:16:43ZWhere is the 'constr' function located?<p>Hi,</p><p>I'm trying to run some code from Brian Smits: <a href = "http://www.cs.utah.edu/~bes/papers/color/">http://www.cs.utah.edu/~bes/papers/color/</a></p><p>And I'm having the following error:</p><p><i>Undefined function 'constr' for input arguments of type 'char'.</i></p><p>The calling code is as follows:</p><pre class="language-matlab">x = pinv(A) *white;
whiteS = x + null(A) * constr('colorFun',zeros(N-3,1),options);
</pre><p>I thought the function was in the <i>Optimization</i> toolbox, but it actually doesn't looks like it.</p><p>Cheers,</p><p>Thomas</p>Thomas Mansencal/matlabcentral/answers/contributors/5333618-thomas-mansencaltag:mathworks.com,2005:Question/1553082014-09-18T14:14:40Z2014-09-18T14:14:40ZI have problem when i am simulating a pneumatic actuator circuit in simscape R2014a.<p>Actually i have developed a pneumatic circuit in simscape.
I connecting a constant pressure source with a constant orifice while developing the model but it is giving a solver setting error while simulating the model.but when i remove the constant orifice block the model is simulating and i getting getting some output.But actually for my design i need to connect pressure source and constant orifice ,then only my design is correct.</p><p>Please help me regarding this issue.</p>Shashikanth/matlabcentral/answers/contributors/5529647-shashikanthtag:mathworks.com,2005:Question/1553032014-09-18T13:50:43Z2014-09-18T14:06:02Zaxis changing when plotting points<p>Im plotting data on an axes using GUIDE. I have a loop where I use the plotyy command to plot 2 graphs, one point at a time. I want to set the axis as fixed which I have done, but wanted to do it once before the loop and have it remain.</p><p>It didn't work, so I have to reset the desired Y axis range on each iteration of the loop where I plot the data (one point at a time).</p><p>Is there a way where I can fix the axis, but still have the data plot one point at a time in a loop (so I can take the axis stuff out of the loop)?</p><p>Thanks
Jason</p>Jason/matlabcentral/answers/contributors/1217570-jasontag:mathworks.com,2005:Question/1552552014-09-18T07:50:17Z2014-09-18T14:00:42ZMatlab2014a pcode and functions: cannot generate pcode due to input argument error? <p>When I attempt to pcode any function, however basic the same error message appears 'Not enough input arguments' this error occurs the first time any input argument to the function is used. If I attempt to write a function without any arguments and pcode it, it returns the error 'Input argument must be a nonempty string.'</p><p>Again, I must emphasise that the functions themselves work, and return no error messages. The only time error messages appear is when I attempt to pcode them.</p><p>I have just updated from 2006b (yes I know very old!) so I need to redo all of my previous pcodes in this version but cannot! Any help would be MUCH appreciated.</p>Emma/matlabcentral/answers/contributors/3684540-emmatag:mathworks.com,2005:Question/1551552014-09-17T10:32:29Z2014-09-18T15:41:30Zreading mutiple images one by one without overwriting<p>to read multiple images one by one from folder without overwriting.i was new to matlab so plz provide me coding to read image1,image2...image89</p>vetri/matlabcentral/answers/contributors/5652936-vetritag:mathworks.com,2005:Question/1552962014-09-18T13:22:24Z2014-09-18T13:58:02Zrename m.file / Simple<p>Hey guys,
how can i rename a function, which was save in a m.file ?
When i started working i gave them stupid name, like PloToCompareResults. Now I want to rename them, but matlabs responds with: this function will be know to matlab as "oldname".How cn change that ?</p>Max Müller/matlabcentral/answers/contributors/5451121-max-mullertag:mathworks.com,2005:Question/1553062014-09-18T13:57:07Z2014-09-18T13:57:07ZSimulink code generation definition handling<p>Hello!</p><p>I want to generate C code from a Simulink model, which I want to build in Altium Tasking. Almost everything is all right, but unfortunatelly there's a problem. I got two declarations into model_private.h header, but it's needed to be a .c source file which contains the definitions. Earlier I generated and used succesfully projects with VisualStudio with theese declarations in header, but the Tasking can't eat this.
I wrote the deffinitions into a TLC file:</p><pre> %openfile buffer</pre><pre> /*Handle of Mutex*/
SemaphoreHandle_t %<SFcnParamSettings.QName>;
%closefile buffer
%<LibCacheDefine(buffer)></pre><p>Now I ask You to help me solve this program please! I think if I make the questionable variables global, it could be a good sollution, but please describe me, how to do this!</p><p>Thank you very much!</p>Matthew/matlabcentral/answers/contributors/5450505-matthewtag:mathworks.com,2005:Question/1553052014-09-18T13:56:57Z2014-09-18T13:56:57Zcalling xPCOpenTcpIpPort when xpc target is running<p>I am calling xPCOpenTcpIpPort from VC application it returns -1 when the XPC target is in loaded and running,, any idea why?</p>Mohamed/matlabcentral/answers/contributors/644484-mohamedtag:mathworks.com,2005:Question/1553022014-09-18T13:50:36Z2014-09-18T13:54:01ZCan single individual MATLAB license be used across multiple computers ? I use student version. Please kindly advise. Thanks<p>Can single individual MATLAB license be used across multiple computers ? I use student version. Please kindly advise. Thanks</p>DAT huynh/matlabcentral/answers/contributors/2349741-dat-huynhtag:mathworks.com,2005:Question/1552982014-09-18T13:36:00Z2014-09-18T13:52:26ZFirst time user of Matlab having issues trying to plot: y=sin x/x on an interval -30<x<30.<p>Below is the code below I created and when I enter it at the >> prompt in the Command window, nothing happens and no graph appears.</p><pre class="language-matlab">x=linespace(-30,30,10001);
y=sin(x)./x;
plot(x,y,'-');
axis([-30 30-1 1])
xlabel('x')
ylabel('y')
title('Fred Smith')
</pre><p>1-is the code correct and do I need to create an m-file ->enter the code then save -> then type in the file name at the >> prompt for it to run. I know this is very basic but I was given the assignment without ever using Matlab and I have been researching this for hours. Thanks</p>James/matlabcentral/answers/contributors/5654550-jamestag:mathworks.com,2005:Question/1552762014-09-18T11:00:48Z2014-09-18T13:50:36Zhow to do vector autoregresion?<p>Hi all!
Well I want to use vector autoregressive model for my case but I do not know exactly which functions should I use.
Any idea would be a great help for me.</p>Giorgi/matlabcentral/answers/contributors/5435287-giorgitag:mathworks.com,2005:Question/1553012014-09-18T13:49:53Z2014-09-18T13:49:53ZPSO coding for multi-objective function-cost fumction and congestion function<p>Hi sir/mam.. i need PSO coding for congestion management-multi-objective function</p>subash/matlabcentral/answers/contributors/5452583-subashtag:mathworks.com,2005:Question/1552852014-09-18T12:08:58Z2014-09-18T13:49:24Zindexing a variable in matlab<p>Hi,
How could i parametrize a data set in matlab. for exemple:</p><p>MeasNr=1</p><p>Meas_(MeasNr) to get Meas_1?</p><p>thank you</p>Rica/matlabcentral/answers/contributors/3745942-ricatag:mathworks.com,2005:Question/1553002014-09-18T13:43:23Z2014-09-18T13:43:23ZVariable length & Stepwise regression<p>I want to create a dataset</p><pre class="language-matlab">A = dataset('File',Araa06.txt');
</pre><p>Matlab returens errors:</p><pre class="language-matlab">Misuse dataset/readFile (line 207) Variable lengths must all be the same.
</pre><pre class="language-matlab">Error dataset (line 351) a = readFile(a,fileArg,otherArgs)
What could be the problem?
</pre><p>If I want to use dataset A for stepwise regression</p><pre> mdl=stepwiselm(A,'Predictor variables','DEM','grad','Response variable','Yield')</pre><p>What is the different between this one and</p><pre class="language-matlab">stepwise
</pre><p>If I just want to do stepwise regression, do I really need to build a model？</p>Yaojiayin/matlabcentral/answers/contributors/5643032-yaojiayintag:mathworks.com,2005:Question/1397702014-07-01T18:42:33Z2014-09-18T13:41:15ZCheck if a function handle is valid<p>I use str2fun(...) to create a function handle from a user-inputted string. I want to be able to run a check to make sure the function created is valid and no typos were made. I could not find a way to do this. Any suggestions?</p><p>Thanks,
Ryan</p><p>MATLAB R2014a</p>Ryan/matlabcentral/answers/contributors/2876359-ryantag:mathworks.com,2005:Question/1552772014-09-18T11:02:33Z2014-09-18T13:39:41ZHelp: Smooth a curve generated from a group of specified points<p>Hi,</p><p>I have 2 vector of x, y coodinates of points</p><p>x=[0 50 935 1870 1935 2805 3740 4675 5610 6545 6746 7480 7911 8415 8590 9004];</p><p>y=[300 600 716 892 900 990 1052 1071 1037 934 900 736 600 393 300 0];</p><p>length(x)=length(y)=16.</p><p>The first curve is generated by plot(x,y).</p><p>Because I want to smooth the orginal curve. From x, y vectors, I want to generate x', y' vectors with length(x')=length(y')=101. And the second curve is generated by plot(x',y').</p><p>Could someone please help me to do this?</p><p>I also created a script to do it, but the result wasn't same as the one I want.</p><p>My script:</p><pre class="language-matlab">clc
clear all
x=[0 50 935 1870 1935 2805 3740 4675 5610 6545 6746 7480 7911 8415 8590 9004];
y=[300 600 716 892 900 990 1052 1071 1037 934 900 736 600 393 300 0];
plot(x,y,'-o');
xnew=linspace(x(1),x(end),101);
ynew=spline(x,y,xnew);
figure
plot(xnew,ynew,'--o');
</pre><p>The curve generated by plot(x,y):</p><img src = "/matlabcentral/answers/uploaded_files/18287/untitled1.png"><p>The curve generated by plot(x',y'):</p><img src = "/matlabcentral/answers/uploaded_files/18288/untitled2.png"><p>The result I want to get:</p><img src = "/matlabcentral/answers/uploaded_files/18289/hull%20line%20drawing.png"><p>Khanh.</p>Khanh/matlabcentral/answers/contributors/5599261-khanhtag:mathworks.com,2005:Question/1552862014-09-18T12:31:18Z2014-09-18T13:27:58ZHelp with Cubic spline interpolation?<p>If I am going to have an block of pixels from image f, and my image g should be interpolated using cubic splines. How do I got about it? What does a cubic spline interpolation do to an image?</p>Nathan/matlabcentral/answers/contributors/4160343-nathantag:mathworks.com,2005:Question/1512592014-08-17T18:55:14Z2014-09-18T13:27:22ZYour current working folder is: C:\Program Files (x86)\Nueva Carpeta\bin Simulink does not permit you to build programs in the MATLAB installation area. Please change to a working folder that is not in the MATLAB installation area.<p>i don´t know why i have is error whith raspberry
Matlab2013 b.</p>Uriel Alejandro Vázquez Hernández/matlabcentral/answers/contributors/5507365-uriel-alejandro-vazquez-hernandeztag:mathworks.com,2005:Question/1540502014-09-08T16:23:32Z2014-09-18T13:17:40ZSimulation Diagnostic Error: CRL: "None" cannot be found in the registry.<p>I am trying to run my simulation and I keep getting a Build and Model Error.
I am using Matlab 2013b and using S-Functions, the Arduino Mega 2560 microcontroller, Simulink Coder, Stateflow, and Embedded coder.</p><p>Attached is a picture of error report I keep getting.</p><img src = "/matlabcentral/answers/uploaded_files/17951/simulation_error_CRL.PNG">Ish/matlabcentral/answers/contributors/5474810-ishtag:mathworks.com,2005:Question/1552722014-09-18T10:46:28Z2014-09-18T13:14:07ZText out goes weird on Figure with underscores<p>Hello, I am trying to output the name of an image file I onto a figure that shows the picture.
The name is obtained from and checks out OK in the matlab window.</p><pre class="language-matlab">out2 =
</pre><pre class="language-matlab">NoSerialNumber_R03C02_3-Swath1_C5_T05_red.tif.
</pre><p>However, it appears on the figure weird</p><p>Im assuming its to do with the underscores - how can I correct it?
Thanks</p><img src = "/matlabcentral/answers/uploaded_files/18286/matlab03.png">Jason/matlabcentral/answers/contributors/1217570-jasontag:mathworks.com,2005:Question/1529672014-08-31T13:36:11Z2014-09-18T13:14:07ZCan matlab read and write EEPROMs in atmel microcontroller on Arduino platform? Did anybody create library?<p>Can matlab read and write EEPROMs in atmel microcontroller on Arduino platform? Did anybody create library?</p>Kevin/matlabcentral/answers/contributors/1189113-kevintag:mathworks.com,2005:Question/1552922014-09-18T12:50:24Z2014-09-18T13:07:59Z2D HCA, clustergram and dendrogram<p>I am using the mac version of Matlab R2013a (8.1.0.604) to perform 2D HCA and create a clustergram of the 2D HCA. I am also getting it to create a dendrogram at the same time. The code I am using is:
data = xlsread('FCTonly')
data = data(:,2:end)
data = xlsread('FCTonly')
samples = data(:,1)
data = data(:,2:end)
variables = xlsread('FCTonlylabels1')
X=pdist(data,'euclidean')
Y=linkage(X,'complete')
Z=dendrogram(Y)
Z=clustergram(data,'linkage', 'average', 'colormap', 'redbluecmap', 'rowlabels', samples)</p><p>The issue I am having, which didn't happen all the other times I have used this, is that the dendrogram for my samples is wrong on the clustergram. The dendrogram it creates when I use the code is correct and has the correct clusters on it but on the clustergram the dendrogram is different and has changed the clusters slightly. Does anyone know why the clustergram and dendrogram would be different as it has never done this before?</p>Christopher Gallacher/matlabcentral/answers/contributors/5659606-christopher-gallachertag:mathworks.com,2005:Question/1550632014-09-16T15:24:19Z2014-09-18T13:06:58ZMultiple integrals with limits as variables<p>I have the function f(z,w,l) and I want to obtain a function g(z) by integrating f(z,w, l) as follows: I need to integrate f for 0 < l < w and then perform the integral for 0 < w < L; where L is a constant. Note that w is a variable while L is a number.
I would appreciate any suggestions.
Thanks</p>Mauricio/matlabcentral/answers/contributors/1717449-mauricio