https://au.mathworks.com/matlabcentral/answers/questionsMATLAB Answers — New Questions2019-10-19T18:41:46Ztag:au.mathworks.com,2005:Question/4855942019-10-16T05:24:27Z2019-10-19T18:41:46Zhow to convert a 3-d binary array of spherical cordinates into floating type array of cartesian cordinatesI have matlab data ("vand_sph61-11.mat") which i linked here. this data has spherical cordinates in binary form and has 3-d array. this data has 1801x59x109 size. 1801 is range by getting from dividing 5 meter to 50 meter into 2.5 cm. 59 is transmitter beams by getting from dividing -29 degree to 29 degree into 1 degree. 109 is receiver beams by getting from dividing -54 degree to 54 degree into 1 degree. I want to convert this data into cartesian cordinates which has floating type.
In this data, i created a 3-d object in which when point exist then have binary value '1' otherwise have binary value '0'.
please help me
VANDANA GUPTAhttps://au.mathworks.com/matlabcentral/profile/authors/12681745-vandana-guptatag:au.mathworks.com,2005:Question/4862852019-10-19T14:27:48Z2019-10-19T18:40:37ZHow to wrap text within buttons of app-designerIs there a way I can chose to wrap the text in my button to a 2nd row, instead of letting it to overflow outside my button?
Thanks!Leonhttps://au.mathworks.com/matlabcentral/profile/authors/3133287-leontag:au.mathworks.com,2005:Question/4863112019-10-19T18:07:33Z2019-10-19T18:38:09ZX and Y must be same length, however they already are?So I am trying to run the following code:
x = [];
y = [];
fid = fopen('HWPlotting.dat');
if fid == -1
disp('Error:Cannot open file')
else
total = 0;
while ~feof(fid)
str = fgetl(fid);
str = str(3:end);
[xstr, rest] = strtok(str, 'y');
y = [y, str2double(rest(3:end))];
total = total + 1;
end
closeresult = fclose(fid);
if closeresult == 0
disp('File closed')
end
end
area(x,y)
xlabel('x')
ylabel('y')
title([num2str(total),' data points'])
However I get the error two errors:
"Error using area (line 52)
X must be same length as Y.
Error in HWPlotting (line 25)
area(x,y)"
The .DAT file I use is simple, it's like this and nothing else:
x 0 y 1.1
x 1.3 y 2.2
x 2.2 y 6
x 3.4 y 7.4
So what's really going on? What in this code is not the same length?
Deniz Mert Yaylahttps://au.mathworks.com/matlabcentral/profile/authors/16428298-deniz-mert-yaylatag:au.mathworks.com,2005:Question/4863132019-10-19T18:24:13Z2019-10-19T18:33:24Zdifference between two programs I have two small programs which must have the same result but in executing them I have some difference and I don't understand where is the problem. The task is to write a simple stand-alone program that converts the loaded source image in the negative one.
X=imread('mosque.jpg');
imshow(X);
[n,m]=size(X);
B=zeros(n, m, 'uint8');
for i=1:n
for j=1:m
B(i,j)=255-X(i,j);
end
end
subplot(2,2,1);
imshow(X);
subplot(2,2,2);
imhist(X);
subplot(2,2,3);
imshow(B);
subplot(2,2,4);
imhist(B);
the second program without the for
X=imread('mosque.jpg');
imshow(X);
[n,m]=size(X);
B=zeros(n, m, 'uint8');
B=255.-X;
subplot(2,2,1);
imshow(X);
subplot(2,2,2);
imhist(X);
subplot(2,2,3);
imshow(B);
subplot(2,2,4);
imhist(B);
boutheina gheribhttps://au.mathworks.com/matlabcentral/profile/authors/16132950-boutheina-gheribtag:au.mathworks.com,2005:Question/4862822019-10-19T13:51:10Z2019-10-19T18:01:26ZHelp with nested for loop generating coordinatesHello,
I need to generate a list of coordinates for electrodes in an electrode array. I figured out how to do this with multiple separate for loops, but I want to find a more elegant way to do it with nested for loops
The array has 9 shanks, and each shank has 32 electrodes. I know (or can work out in my head) the xyz coordinates of the first electrode in each shank and I know the spacing between shanks and between electrodes
So I created a vector with the xyz coordinates of the first electrode in the first shank
E1=[0.00470, 0.00470, 0]
Then created a for loop to iterate for the other 31 electrodes (since each electrode is 0.00005 metres further in the z axis):
for i=2:32
E1(i,:) = E1(1,:) + [0, 0, 0.00005*(i-1)]
end
I then created a second matrix and for loop for the second shank (notice the first coordinate of the first row has advanced by 0.00030 because this is the distance in the x axis between shanks 1 and 2)
E2 = [0.00500, 0.00470, 0]
for i=2:32
E2(i,:) = E2(1,:) + [0,0,0.00005*(i-1)]
end
I do this for all 9 shanks, changing the coordinates each time, and then concatenate the 9 arrays:
E = vertcat(E1,E2,E3,E4,E5,E6,E7,E8,E9]
I appreciate that this is a very long winded and clumsy way of doing it, so how can I create a nested for loop with one index for the shank number and a second index for the electrode number, cycling through each shank and each electrode and altering the coordinates as need to produce one continuous array of coordinates?
Adam Fitchetthttps://au.mathworks.com/matlabcentral/profile/authors/14201668-adam-fitchetttag:au.mathworks.com,2005:Question/4862582019-10-19T08:19:31Z2019-10-19T18:00:21ZUsing a tolerance in X with fzero function (by default the tolerance is evaluated on Y axis). Good morning,
I've been wondering how to modify the fzero function so that it evaluates tolerance in X instead of in Y.
Thank you for your help.Ernest Staffetti Cruañashttps://au.mathworks.com/matlabcentral/profile/authors/16157380-ernest-staffetti-cruanastag:au.mathworks.com,2005:Question/4830802019-10-01T17:25:44Z2019-10-19T17:55:43ZWhat is the origin of this bus error?I had been running some monte-carlo simulations on a cluster node (Linux) for over a week using parfor, when a crash happened at about 70% done (time evolution, so the problem does not become progressively harder), and I don't understand the report. Luckily I saved some intermediate results, but I would prefer to have an idea of what went wrong before I try again. In principle, all code in the script has been accessed before on the same machine without troubles.
The error is the following:
[�Warning: A worker aborted during execution of the parfor loop. The parfor loop
will now run again on the remaining workers.]�
[�> In parallel_function (line 599)
In seekGdeptransition_forcluster_Nrealdep (line 51)]�
--------------------------------------------------------------------------------
Bus error detected at Sat Sep 28 05:55:53 2019 +0200
--------------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled - No sandbox or build area path
Crash Mode : continue (default)
Default Encoding : UTF-8
Deployed : false
GNU C Library : 2.17 stable
Graphics Driver : Unknown software
Java Version : Java 1.8.0_144-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
MATLAB Architecture : glnxa64
MATLAB Entitlement ID : 815978
MATLAB Root : /ssoft/spack/external/MATLAB/R2018a
MATLAB Version : 9.4.0.813654 (R2018a)
OpenGL : software
Operating System : "Red Hat Enterprise Linux Server release 7.6 (Maipo)"
Process ID : 18832
Processor ID : x86 Family 6 Model 79 Stepping 1, GenuineIntel
Session Key : db19bbbe-1534-4337-b32d-f6c8548df595
Static TLS mitigation : Disabled: Unable to open display
Window System : No active display
Fault Count: 1
Abnormal termination
Register State (from fault):
RAX = 00002ac3ad3a2c40 RBX = 0000000000000000
RCX = 00002ac37e0e2d12 RDX = 0000000000000000
RSP = 00002ac3d650b878 RBP = 00002ac3d650b8e0
RSI = 0000000000000000 RDI = 00002ac3b2f1ef50
R8 = 00002ac3b2f1ef28 R9 = 0000000000000000
R10 = 00002ac3d650b8a0 R11 = 0000000000000000
R12 = 000000000000006e R13 = 00002ac3b2f1ef00
R14 = 00002ac3b2f1ef50 R15 = 00002ac3b2f1ef28
RIP = 00002ac3ac643fd0 EFL = 0000000000010202
CS = 0033 FS = 0000 GS = 0000
Stack Trace (from fault):
[ 0] 0x00002ac3ac643fd0 /ssoft/spack/external/MATLAB/R2018a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+02228176
[ 1] 0x00002ac3acd4cad0 /ssoft/spack/external/MATLAB/R2018a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+09603792
[ 2] 0x00002ac3acd0815e /ssoft/spack/external/MATLAB/R2018a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+09322846
[ 3] 0x00002ac3acd08726 /ssoft/spack/external/MATLAB/R2018a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+09324326
[ 4] 0x00002ac3ace96c01 /ssoft/spack/external/MATLAB/R2018a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+10955777
[ 5] 0x00002ac3ace9843e /ssoft/spack/external/MATLAB/R2018a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+10961982
[ 6] 0x00002ac3acd4e338 /ssoft/spack/external/MATLAB/R2018a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+09610040
[ 7] 0x00002ac37e0dedd5 /lib64/libpthread.so.0+00032213
[ 8] 0x00002ac37c86502d /lib64/libc.so.6+01040429 clone+00000109
[ 9] 0x0000000000000000 <unknown-module>+00000000
** This crash report has been saved to disk as /home/wverstra/matlab_crash_dump.18832-1 **
MATLAB is exiting because of fatal error
/var/spool/slurmd/job2941726/slurm_script: line 13: 18832 Killed matlab -nodisplay -r "seekGdeptransition_forcluster_Nrealdep(10,100);quit"
FINISHED at Sat Sep 28 05:55:54 CEST 2019
slurmstepd: error: Detected 2 oom-kill event(s) in step 2941726.batch cgroup. Some of your processes may have been killed by the cgroup out-of-memory handler.
note that line 51 of file "seekGdeptransition_forcluster_Nrealdep.m" is just
parfor rr=1:NrealWouterhttps://au.mathworks.com/matlabcentral/profile/authors/9277404-woutertag:au.mathworks.com,2005:Question/4863102019-10-19T17:45:47Z2019-10-19T17:45:47ZExtract values from imageHi,
I've got some data from a magnetic measurement on a surface.
I've plotted these data (see the attached pic). Is there a possibillity to get or extract values from this plot.
I need all values of the picture along the red line.
Many thanks for your help and best regards!!!
René Dienemannhttps://au.mathworks.com/matlabcentral/profile/authors/16029044-rene-dienemanntag:au.mathworks.com,2005:Question/4862862019-10-19T14:36:17Z2019-10-19T17:37:44ZCan only choose pi radians / sample in Passband frequency, not Hz.As the title says. I'm trying to use preprocessing options in Signal Analyzer and it doesn't present me with a Hz option when inputting the passband frequency, what could the reason be?Ahmet Alper Özkanhttps://au.mathworks.com/matlabcentral/profile/authors/16073189-ahmet-alper-ozkantag:au.mathworks.com,2005:Question/4863092019-10-19T17:36:34Z2019-10-19T17:36:34ZPlot 2D graph - parameters explanation?Hello, I have a few questions about editing my graph in MATLAB.
Questions are:
1) How can I have a grid like this (you can see dots starting at every section on y axis (0.5, and 1), and on x axis)
2) This line of code
stem(x,y,'bv:','MarkerSize',6,'LineWidth',2)
does not give me exactly the same output as here in the picture. I can't figure it out why (I tried many combinations, but didn't work)
Thanks in advance
Faris Hajdarpasichttps://au.mathworks.com/matlabcentral/profile/authors/14824638-faris-hajdarpasictag:au.mathworks.com,2005:Question/4862482019-10-19T06:56:59Z2019-10-19T17:34:54ZHow to plot a series of shapesFor circle, square and annulus write a program to find the area, perimeter (or circumference) for a range of parametric values given by the user and plot the corresponding shapes in the range given. User needs to identify lower and upper values of each parameter. The identified range for the parameters should be then divided into 10 monotonic steps inside your program. Accordingly, you need to calculate the values and plot the shapes corresponding to all 10 values in the range identified by the user. The program should plot the geometries in the first quadrant.
I have been able to write the program for a range of parametric values to calculate the area and the perimeter.However, im not sure how to plot these 10 values in order to create 10 squares. Please help.Thanks
AStarhttps://au.mathworks.com/matlabcentral/profile/authors/16242449-astartag:au.mathworks.com,2005:Question/4862932019-10-19T15:10:31Z2019-10-19T17:33:19ZVariables keep overwriting when i change the nameI am trying to obtain 5 current values and 5 voltage values on my simulink project. The outputs of both are generated with a 'To Workspace' block. When i run simulink i get my variables 'current' and 'voltage' without a problem. However, when i change the circuit i change the variable names to 'current1' and 'voltage1' and when i run simulink. The new variables overwrite the first ones. Im trying to get values like current, current1, current2 etc but matlab only saves the most recent values. Does anyone know how to fix this?
Paul Raehttps://au.mathworks.com/matlabcentral/profile/authors/16564084-paul-raetag:au.mathworks.com,2005:Question/4863082019-10-19T17:32:39Z2019-10-19T17:32:39ZUnable to save/load objects created by App designer ? (R2019a)Hi, I'm using App Designer to build an app with a uitree and a uitable. The tree/table is editable in the app during runtime. I want the edited tree/table to be saved to a local place, and also be able to be loaded in the future.
But warning shows "Unable to save/load the object created by App designer" and the process is not working. It seems Matlab has banned the save/load function for objects created by Appdesigner. I'm wondering if there is a way to walk around this, or is there anyway to export the uitree to some other type of file, maybe .xls, for reuse? Thank you for reading.
function Button_Save(app, event)
ProgramTree=app.Tree;
uisave('ProgramTree','TreeSave')
end
function Button_Load(app, event)
ProgramTree= load('TreeSave.mat');
app.Tree=ProgramTree;
end
Insohttps://au.mathworks.com/matlabcentral/profile/authors/11944257-insotag:au.mathworks.com,2005:Question/4862972019-10-19T15:32:13Z2019-10-19T17:29:23ZCreating two row matrices out of any initial matrix that would contain each element inside the initial matrix and the one in the previous column.I am trying to create two row matices out of an initial matrix. The two row matrices need to contain each element inside the initial matrix and its previous one.
The code is not good, but are there any shortcuts expressed as MATLAB commands, or any ideas to improve my code?
r = [4 5 6; 4 3 2; 1 4 5]
A = zeros(size(r,1)*size(r,2),2)
function A = breakintopieces(r)
A = zeros(size(r,1)*size(r,2),2)
for i = 1:size(r,1)
for j = 1:size(r,2)
A((i*j),1) =A(i,j-1);
A((i*j),2) =A(i,j);
end
end
endfunctionGEORGIOS BEKAShttps://au.mathworks.com/matlabcentral/profile/authors/11075599-georgios-bekastag:au.mathworks.com,2005:Question/4863072019-10-19T17:24:55Z2019-10-19T17:24:55Ziterate through multiple files in a folderfunction [] = lanczos(A, m)
A = readmatrix('output1.txt','Whitespace',' []');
here A reads a single text file.
But i wanted A to read multiples text files(may be using for loop) stored in a folder(say graphs) and the function needs to run through all of them and display output for every text file.
can someone help me with this.Nitish Reddy Kotkurhttps://au.mathworks.com/matlabcentral/profile/authors/16284860-nitish-reddy-kotkurtag:au.mathworks.com,2005:Question/4863052019-10-19T17:08:29Z2019-10-19T17:24:15ZCell to 3D MatrixHi, I've found many similar questions relating the transformation from cell-array to 3D matrix, but none of the solutions worked for me (or I was unable to adapt the solutions for my problem)
I have a (20x1) cell array and each cell contains a 360x900 matrix. Optimally, the new 3D matrix has the dimension 900x20x360 but 360x900x20 would also work for me.
Thanks for your help!Gerrit Liedtkehttps://au.mathworks.com/matlabcentral/profile/authors/12573007-gerrit-liedtketag:au.mathworks.com,2005:Question/4453352019-02-16T20:35:54Z2019-10-19T17:21:29ZComputer Login Name for license centerThe article explaining how to find my computer login name is disabled. Apparently because it's been 14 days or something. Can someone tell me how to either access the article or find the name?Benjamin Moakhttps://au.mathworks.com/matlabcentral/profile/authors/12035524-benjamin-moaktag:au.mathworks.com,2005:Question/506442012-10-12T16:51:18Z2019-10-19T17:13:02ZSampling frequency and FFT output ?What is the relationship between the fs (sampling frequency) and the amplitude of the FFT-function output in matlab? As the amplitude of the FFT output changes as the sampling frequency is changed.
Invizible Soulhttps://au.mathworks.com/matlabcentral/profile/authors/3678239-invizible-soultag:au.mathworks.com,2005:Question/4862782019-10-19T12:54:59Z2019-10-19T17:12:51ZCreating multiple polar plot graphs for different frequenciesEssentially trying to use a loop to generate multiple plots for different values of f.
I get this error message:
Index exceeds the number of array elements (1).
Error in PistonDirectivity_2_11 (line 21)
f = f(n);
f = [125 250 500 1000 2000 4000 8000];
%f = 3.3820e+03; %frequency
c = 340; %speed of sound at 20 degrees
rho0 = 1.2; %Acoustic impedance at 20 degrees
r = 100; %radius
a = 0.16; %piston radius
u0 = 1; %particle velocity
theta = linspace(-pi/2+1.e-16,pi/2-1.e-16,181)'; %range of theta values from 90 to -90 degrees
%p = (1j*rho0*c*k*a^2*u0/(2*r) .* 2.* besselj(1,kasintheta)./kasintheta) * exp(-1j*k*r);
n = 1;
%% loop to make multiple plots
%while n < length(f)
for n = 1 : length(f)
f = f(n);
k = 2*pi*f./c; %wavenumber
p = besselj(1, k*a.*sin(theta))./(k*a.*sin(theta));
db = 20*log10(abs(p)); %calculate dB and plot polar response
mx = max(db);
dynamic_range = 40;
db = db + dynamic_range - mx;
db = max(db,zeros(size(db)));
polar(theta,db); %plot polar response
figure %plot flat response
plot(theta,db)
xlabel('Theta (rads)')
ylabel('Level (dB)')
hold on
n = n+1;
endCameron Lattahttps://au.mathworks.com/matlabcentral/profile/authors/16303696-cameron-lattatag:au.mathworks.com,2005:Question/990672013-03-05T15:36:00Z2019-10-19T17:10:07ZWhy do I receive License Manager Error -9?When I try to launch MATLAB, I get the following error:
ERROR: License checkout failed. Invalid host. License Manager Error -9
MathWorks Support Teamhttps://au.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:au.mathworks.com,2005:Question/105312011-06-29T15:06:58Z2019-10-19T17:06:35ZRun telnet with cmd in MATLAB command windowHey,
I have some trouble with using the command interface in MATLAB.
When I run system('cmd'), the command prompt starts and is displayed in the matlab command window. When I now type telnet at the cursor position in my matlab command window, it does not know the command 'telnet'.
When I start telnet in the normal windows command window without any matlab stuff, everything works fine with that command.
What can be wrong with that?
Thanks,
MartinMartinhttps://au.mathworks.com/matlabcentral/profile/authors/2820834-martintag:au.mathworks.com,2005:Question/4304432018-11-17T15:07:47Z2019-10-19T17:03:45ZI was facing problem in activation matlab 2017a. I enter the path of license for activation and it gets complete but when i start matlab it again demands activation.Now I have change the calender date of my laptop i.e., 2016. Matlab is running now but the problem is that by changing date to previous year I can't use google. This means I can't use matlab and internet at the same time.Tell me how to cope with this problem?Sajid Sarwarhttps://au.mathworks.com/matlabcentral/profile/authors/11672676-sajid-sarwartag:au.mathworks.com,2005:Question/4862882019-10-19T14:44:35Z2019-10-19T16:57:50Z how to plot a continuous signalI want to plot x(t) = cos(200*pi*t*u(t)) and define u(t) seprately and then plot x(-t),x(t/3)
i wrote this
x = @(t) cos(200*pi*t*u(t));
t = linspace(-1, 1);
figure(1)
plot(t, x(t))
grid
function y = u(x)
y=0;
if x>=0
y=1;
end
end
Mohsmmadreza kalantarihttps://au.mathworks.com/matlabcentral/profile/authors/16619283-mohsmmadreza-kalantaritag:au.mathworks.com,2005:Question/4862592019-10-19T08:19:32Z2019-10-19T16:57:15ZCould anybody tell me how to replace these loops with either parfor or vectorization as the code right now runs extremely slowly?[rows, columns, numberOfColorChannels] = size(face); % face is an image matrix
for x=1:rows
for y=1:columns
if(red(x,y)>=150)
n = n+1;
rtot = sum(double(red(:)));
end
end
end
rmean= rtot/n;
for x=1:rows
for y=1:columns
red_pixel= red(x,y);
if(red_pixel>=200)
if(red_pixel> rmean)
blush= blush+1;
rblush = sum(double(red_pixel(:)));
end
end
end
end
perc_blush(i)= (blush/(rows*columns))*100;
perc_pale(i)= ((abs(rblush-rmean))/(rows*columns))*100;
Aishwarya Jayachandranhttps://au.mathworks.com/matlabcentral/profile/authors/16237238-aishwarya-jayachandrantag:au.mathworks.com,2005:Question/4857802019-10-17T00:56:08Z2019-10-19T16:54:25ZMATLAB Result Figure for genetic algorithmHi all,
I have a question about the plot that MATLAB creates runnig genetic algorithm. The vertical axis shows the "number of individuals" and the horizontal axis shows "score". In Mathwork website, I found the definition for these as below:
number of individuals: number of population in each generation
score: fitness function or objective function value
My questions are:
Is the the diagram shows the values correspond to all of the iterations from start to end, or it just shows the values for the last iteration?
Based on my understanding the "population size" should remain the same for all the generations, if this is correct why it keeps changing in this diagram?
Thank you so much for your time and consideration.
Maryamhttps://au.mathworks.com/matlabcentral/profile/authors/13165062-maryamtag:au.mathworks.com,2005:Question/4862082019-10-18T19:49:11Z2019-10-19T16:52:43ZProperty inspector can not be used any more on macI cannot use the property inspector in figure any more after the macos update.
dongfei chenhttps://au.mathworks.com/matlabcentral/profile/authors/15895741-dongfei-chentag:au.mathworks.com,2005:Question/4863002019-10-19T15:47:23Z2019-10-19T16:50:36ZI want to do the same action to every files(.png) in one folder, but I face some problem.I want to put 1092 files(109 x 109 .png image) in the center of 227 x 227 matrix, so I write down a code like this
files = dir('*.png') ; % I am in folder of the png files
N = length(files) ; % total number of files
% loop for each file
for i = 1:N
x = files(i).name ;
b=imread('x');
a=zeros(227);
a(60:168,69:159)=b;
a=uint8(a);
end
end
answer
Error using imread>get_full_filename (line 516)
File "x" does not exist.
Error in imread (line 340)
fullname = get_full_filename(filename);
How can I process all my files in the folder, and save as .png in a new folder ? YuCheng Chenhttps://au.mathworks.com/matlabcentral/profile/authors/16573400-yucheng-chentag:au.mathworks.com,2005:Question/4862622019-10-19T08:42:30Z2019-10-19T16:47:32ZAre MATLAB updates supersed each other or we must install the whole packages?For example, in Matlab R2019a release there are six updates as shown in this link
https://www.mathworks.com/downloads/web_downloads/show_updates?release=R2019a
For Windows
Update 1 = 1010 MB
Update 2 = 2.51 GB
Update 3 = 3.31 GB
Update 4 = 4.12 GB
Update 5 = 7.89 GB
Update 6 = 8.35 GB
Furthermore, if we take a look on the Bug Reports page of R2019a release
https://www.mathworks.com/support/bugreports/?firf=R2019a&release=R2019a&release_filter=Fixed+in&sort_by=report-id-asc&utf8=%E2%9C%93
If we download the update 6 package, we'll get all of the previous updates, isn't it some kind of redundancy or a must?
Does it mean that each update package address different bugs and not supersed each other?
I mean, 8 GB is quite a lot for an update, I thought the update 6 package supposely only need 1GB because it superseed the previous update packages.James Richardhttps://au.mathworks.com/matlabcentral/profile/authors/10832783-james-richardtag:au.mathworks.com,2005:Question/4863042019-10-19T16:37:55Z2019-10-19T16:46:31ZUsing Subplot in matlabI couldn't figure how to solve that ! can anyone help me understand it ?
Ahmed Salehhttps://au.mathworks.com/matlabcentral/profile/authors/16620034-ahmed-salehtag:au.mathworks.com,2005:Question/2989032016-08-08T18:40:40Z2019-10-19T16:45:45ZHelp Stitching Photos TogetherI am trying to stitch 2 photos together using the reference code found here almost verbatim
<http://www.mathworks.com/help/vision/examples/feature-based-panoramic-image-stitching.html>
Some differences:
My photos are already greyscale, so I skip line:
grayImage = rgb2gray(I);
and just have:
grayImage = I;
I have only 2 photos of identical size (in pixels), so I am retaining the transformation of the second image relative to the first image, i.e. totally skipping the code in the example that "invert[s] the transform for the center image and apply[s] that transform to all the others." This means that tforms(1) remains an identity matrix as created by the initializing statement:
tforms(buildingScene.Count) = projective2d(eye(3));
I don't get any errors until almost the last line:
Error using AlphaBlender/step
The Image 1 and Image 2 inputs must have the same number of dimensions.
Error in stitchCntl (line xxx)
panorama = step(blender, panorama, warpedImage, warpedImage(:,:,1));
I have goggled the error message with no hits, and am at a loss as to how to proceed. Any help is greatly appreciated.
Thank you to all!
Andreas Grothueshttps://au.mathworks.com/matlabcentral/profile/authors/8339585-andreas-grothuestag:au.mathworks.com,2005:Question/4862692019-10-19T10:57:39Z2019-10-19T16:42:25ZWhy does solve() parametrize the results in the conditions?Hello, everyone.
This is my first question on MATLAB Answers. I am usually able to find solutions to my MATLAB problems without the need to ask for help, but I have been stuck on this problem for three full days now and I am ready to throw in the towel.
Let me begin by stating my goal. I have a set of six equations with nine variables. This system of equations define the behaviour of a TEC module, also called a Peltier module. My goal is to solve this set of equations by fixing two of the variables and letting one variable be free.
The variables are as follows:
T_h : Hot-side temperature [K]
T_c : Cold-side temperature [K]
DT : Temperature difference between hot-side and cold-side [K]
V_in : Voltage across the TEC [V]
I_in : Current going through the TEC [I]
P_in : Power being used by the TEC [W]
Q_c : Heat being pumped from the cold-side to the hot-side [W]
Q_h : Heat being dumped into the hot-side [W]
COP : Coefficient of performance
The equations are as follows
dt_eq = DT == T_h-T_c;
qc_eq = Q_c == 0.05*T_c*I_in - 1.5*I_in^2 - 0.5*DT;
vin_eq = V_in == 0.05*DT + I_in*1.5;
pin_eq = P_in == V_in*I_in;
qh_eq = Q_h == P_in + Q_c;
cop_eq = COP == Q_c/P_in;
To reiterate: My goal is to fix any two of the variables, leave one free variable, and solve the set of equations for the remaining six variables as a function of the one free variable. This will allow me to investigate the expected behaviour of the Peltier element as a function of any variable and under the conditions which are set by the two fixed variables.
The problem
For certain free variables, I am able to solve the set of equations. However, for many other variables, the solver either returns no solution when there clearly is a solution, or the solutions is annoyingly found as parametrized in the conditions of the returned answer!
As an example, I set up my code as follows (some pseudocode involved):
syms DT Q_c V_in P_in I_in T_h T_c Q_h COP
%Fix two variables.
T_h = 300; %Hot side temperature is 300 Kelvin
Q_c = 1; %Heat pumped from cold-side to hot-side is 1 Watt.
%Equations definitions goes here, see code snippet above
dt_eq = ...
qc_eq = ...etc
%Set assumptions
assume(T_h>0 & T_c>0) %Temperatures in Kelvin cannot be 0 or negative.
assumeAlso(V_in>=0 & I_in>=0) %Equations are not valid for reversed polarity
%Create array of all the equations
equations = [dt_eq, qc_eq, vin_eq, pin_eq, qh_eq, cop_eq]
%Create array of the variables I want to solve for. Note that P_in is missing.
%This is because I want the solutions to be functions of P_in.
variables = [DT V_in I_in T_c Q_h COP]
%Solve equations
sol = solve(equations, variables, 'real', true, 'ReturnConditions', true, 'MaxDegree', 3);
The returned object sol is as follows:
sol =
struct with fields:
DT: [1×1 sym]
V_in: [1×1 sym]
I_in: [1×1 sym]
T_c: [1×1 sym]
Q_h: [1×1 sym]
COP: [1×1 sym]
parameters: [1×6 sym]
conditions: [1×1 sym]
Each variable (DT, V_in, I_in, etc) has become parametrized:
>> pretty(sol.DT)
z1
>> pretty(sol.V_in)
z2
And the actual equations for z1, z2, z3, etc., are found in the conditions together with all the other conditions that the parametrized solutions are valid for. I am not going to post it here because the output is large, so I am attaching it as Conditions.txt.
I am happy with parametrized equations, but why in the world are they defined in the conditions? I do not know how I can reliably and programatically extract the symbolic equations from the definitions.
Magne Lauritzenhttps://au.mathworks.com/matlabcentral/profile/authors/13000759-magne-lauritzentag:au.mathworks.com,2005:Question/4862812019-10-19T13:47:12Z2019-10-19T16:26:55ZHow can I solve the error of {Undefined operator '.^' for input arguments of type 'optim.problemdef.OptimizationExpression'}?Hi,
I am running a Matlab Optimization Problem example as explained here, using MATLAB R2017b version :
https://www.mathworks.com/help/optim/ug/nonnegative-least-squares-problem-based.html
But I receive the folowing error:
Undefined operator '.^' for input arguments of type 'optim.problemdef.OptimizationExpression'.
Can anyone help with a hint about how to solve it?
Thank you!Sedi Ghanhttps://au.mathworks.com/matlabcentral/profile/authors/16618883-sedi-ghantag:au.mathworks.com,2005:Question/4577522019-04-22T07:07:44Z2019-10-19T16:17:37ZFitting Monod Equation with ODE45 to data using lsqcurvefit functionHello!
I am fitting Monod equation to a data containing substrate (s), biomass (x), and ethanol (p) concentration against time. The objective is to get the parameters: 1) umax, 2) ks, 3) Yxs, and 4)Yps that will best represent the data. The differential equations are:
Here is my initial code using assumed values of the four parameters:
umax = 0.5;
ks = 6.5;
Yxs = 0.2;
Yps = 1.2;
%a(1) = x
%a(2) = s
%a(3) = p
f = @(t,a) [umax*a(1)*a(2)/(ks + a(2)); -(1/Yxs)*umax*a(1)*a(2)/(ks + a(2)); (1/Yps)*umax*a(1)*a(2)/(ks + a(2))];
xt0 = [0.0904,9.0115,0.0151];
[tspan,a] = ode45(f,[0 25],xt0);
figure
plot(tspan,a(:,1),tspan,a(:,2),tspan,a(:,3))
Here is the code for trying to fit it into the actual data (script file):
function pos = paramfun1(x,tspan)
umax = x(1);
ks = x(2);
Yxs = x(3);
Yps = x(4);
xt0 = x(5:7);
f = @(t,a) [umax*a(1)*a(2)/(ks + a(2)); -(1/Yxs)*umax*a(1)*a(2)/(ks + a(2)); (1/Yps)*umax*a(1)*a(2)/(ks + a(2))];
[~,pos] = ode45(f,tspan,xt0);
Here is my call function (in the command window):
xt0 = zeros(1,7);
xt0(1) = umax;
xt0(2) = ks;
xt0(3) = Yxs;
xt0(4) = Yps;
data =[0 3 5 8 9.5 11.5 14 16 18 20 25 27, 0.0904 0.1503 0.2407 0.3864 0.5201 0.6667 0.8159 0.9979 1.0673 1.1224 1.1512 1.2093; 0 3 5 8 9.5 11.5 14 16 18 20 25 27, 9.0115 8.8088 7.9229 7.2668 5.3347 4.911 3.5354 1.4041 0 0 0 0; 0 3 5 8 9.5 11.5 14 16 18 20 25 27, 0.0151 0.0328 0.0621 0.1259 0.2949 0.3715 0.4199 0.522 0.5345 0.6081 0.07662 0.7869];
%time =[0 3 5 8 9.5 11.5 14 16 18 20 25 27];
[pbest,exitflag,output] = lsqcurvefit(@paramfun,xt0,tspan,data);
fprintf('New parameters: %f, %f, %f, %f',pbest(1:4));
The error is function value not equal to YDATA. Btw, this code was based from an example in MATLAB. (https://www.mathworks.com/help/optim/ug/fit-differential-equation-ode.html)
My data is:
time = [0 3 5 8 9.5 11.5 14 16 18 20 25 27]
x = 0.0904 0.1503 0.2407 0.3864 0.5201 0.6667 0.8159 0.9979 1.0673 1.1224 1.1512 1.2093
s = 9.0115 8.8088 7.9229 7.2668 5.3347 4.911 3.5354 1.4041 0 0 0 0
p = 0.0151 0.0328 0.0621 0.1259 0.2949 0.3715 0.4199 0.522 0.5345 0.6081 0.07662 0.7869
Please help! I do not know how to input my data into the lsqcurvefit function.
Thanks in advance!StarSign1997https://au.mathworks.com/matlabcentral/profile/authors/15259909-starsign1997tag:au.mathworks.com,2005:Question/4862872019-10-19T14:37:48Z2019-10-19T16:02:37ZWhen using polarplot, why does the argument come before the modulus? I thought the convention for polar coordinates was (r,theta), not (theta, r)?
Is there a reason for this, or was this question a waste of space?Max Allenhttps://au.mathworks.com/matlabcentral/profile/authors/16612554-max-allentag:au.mathworks.com,2005:Question/4863022019-10-19T16:01:49Z2019-10-19T16:01:49ZProblem in "Attribute Function" in SImevents (MATLAB)I am running a FIFO queue model for restaurent simulation using simevents, when I use "Attribute Function" to control the attributes from script file, I get the following error.
"The current directory 'f:\matlab17a install\bin' is reserved for MATLAB files.
Please change your current directory to a writeable directory outside of the MATLAB installation area."
Please help me to sort out this issue.Sajid Sarwarhttps://au.mathworks.com/matlabcentral/profile/authors/11672676-sajid-sarwartag:au.mathworks.com,2005:Question/4862912019-10-19T15:00:08Z2019-10-19T15:58:59ZNeed help implementing a 2D circular gaussianI have the next equation which represents a circular gaussian. I have a little trouble because when I plot this equation gives me a normal gaussian. I can't see any circular shape. I have the next code:
x = linspace(-3, 3);
y = x;
R = {3, 2, 1};
for i=1:length(R)
f = exp(-((x/R{i}).^2 + (y/R{i}).^2));
hold on;
grid on;
plot3(x, y, f);
end
This code produce me the next plot:
Luis Miguel López Santamaríahttps://au.mathworks.com/matlabcentral/profile/authors/10245780-luis-miguel-lopez-santamariatag:au.mathworks.com,2005:Question/4862712019-10-19T11:29:00Z2019-10-19T15:57:58Zto plot a introduced functionhi. i wrote 4 functions. now i want to plot the forth function but it gives me errors. plz help me to plot it.
plot3(C(J,d),J,d)
function ha = H(J,d)
sx=[0 1;1 0];
sy=[0 -1i;1i 0];
sz=[1 0;0 -1];
ha = J/2*(kron(sx,sx)+kron(sy,sy)+kron(sz,sz))+d*(kron(sx,sy)-kron(sy,sx));
end
function ro = R(J,d)
T=0.5;
ro = expm(-H(J,d)/T)/trace(expm(-H(J,d)/T));
end
function la = landa(J,d)
sy=[0 -1i;01i 0];
s=kron(sy,sy);
la = real(sqrt(eig(R(J,d)*s*conj(R(J,d))*s)));
end
function co = C(J,d)
co=max(0,2*max(landa(J,d))-sum(landa(J,d)));
end
reza hamzehhttps://au.mathworks.com/matlabcentral/profile/authors/16618054-reza-hamzehtag:au.mathworks.com,2005:Question/4862952019-10-19T15:15:41Z2019-10-19T15:52:23ZCreate a table in MatLab with specific data in different spreadsheets in one Excel File.Hello together,
I have an Excel File with 10 spreadsheets and I want to import data (always range: A2:K7) from every spreadsheet into a table in MatLab. I want to create a Loop so that the data is displayed beneath one another.
Thank you for your support!Leon Wohlgemuthhttps://au.mathworks.com/matlabcentral/profile/authors/16069548-leon-wohlgemuthtag:au.mathworks.com,2005:Question/4862982019-10-19T15:38:28Z2019-10-19T15:50:06ZHow to read multiple arrays from a text file?I have a file like the one I attached.I want to read this file in MATLAB and store in seperate arrays like:
A = [2, 3, 4;5, 3, 0]
B= [6, 4, 2;1, 6, 9].
Or in a cell.
Also if anyone can suggest if I have a large number of datas and where it would be not be possible to store them individually.Abhirup Chaudhurihttps://au.mathworks.com/matlabcentral/profile/authors/16619594-abhirup-chaudhuritag:au.mathworks.com,2005:Question/3132412016-11-21T09:29:51Z2019-10-19T15:49:30ZInvalid file identifier. Use fopen to generate a valid file identifier.Hello,
I am trying to open a file, skip the first 6 lines (headers) and extract data from the rest of the lines in the file.
Here is the code:
%% Declarations
targetinfo(1000)=struct('distance', 0, 'speed', 0, 'angle', 0, 'rcs', 0);
i=1; %index
count=0; %file size counter
[fid, message]=fopen('log.asc','r'); %open log file
%% Read file and extract relevant data
if fid==-1
disp('Error')
else
for k=1:6
header=fgetl(fid); %skip headers
end
while ~feof(fid)
line=fgetl(fid);
if line(16)=='S' || line(13)=='C' || line(1)=='T' %remove control and status signals
continue;
end
id=str2num(line(16:18));
line=line(41:63);
line=line(~isspace(line));
if id==100
canstatus=hex2dec(line(1:2));
targetcount=hex2dec(line(3:4));
canchannel=hex2dec(line(9:10));
else
targetinfo(i).distance=hex2dec(line(1:4));
targetinfo(i).speed=hex2dec(line(5:8));
targetinfo(i).angle=hex2dec(line(9:12));
targetinfo(i).rcs=hex2dec(line(13:16));
end
count=count+1; %increase file size counter
i=i+1; %increase index
fclose(fid); %close file
end
end
I am getting the error I have specified in the title. The value of fid returned is not -1 (it is 4 at the moment) and I do have access to the file, since I can open it in Notepad to view its contents.
I am not opening and closing the file multiple times, just once. Is there any reason I'm missing out?
Thank you for your help.Pranav Thiagarajanhttps://au.mathworks.com/matlabcentral/profile/authors/9191118-pranav-thiagarajantag:au.mathworks.com,2005:Question/4863012019-10-19T15:48:02Z2019-10-19T15:48:02Zhow can i plot an airfoil with rounded trailing edge?hello everyone, i am trying to plot NACA 0012 airfoil in matlab with rounded trailing edge. To make the trailing edge round, i am trying to put semi ellipse at the end of the airfoil but that's not working. The ellipse is not attaching with the airfoil completely. I want the code to be generic because later i have to morph the TE for analysis. so when i morph the TE, the ellipse moves with it.
any help would be appreciated. ThanksTalha Darhttps://au.mathworks.com/matlabcentral/profile/authors/14193324-talha-dartag:au.mathworks.com,2005:Question/4862832019-10-19T14:01:15Z2019-10-19T15:47:29ZI have problem writing a matlab functionI want to write this function in matrix form.
The function is
I defined the vector as:
Then what is wrong with my code?
function [ ObjVall ] = objfun2( phen)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
x=(5/pi)*phen(1:end,1)-6;
y=phen(1:end,2) - (5.1/(4*pi^2)).*(phen(1:end,1).^2 +x);
z=10*(1 - (1/(8*pi))*cos(phen(1:end,1)));
ObjVall=(y).^2 + z +10;
end
Cantor Sethttps://au.mathworks.com/matlabcentral/profile/authors/14440086-cantor-settag:au.mathworks.com,2005:Question/4862992019-10-19T15:38:57Z2019-10-19T15:39:24ZHow to export trained Faster RCNN to another hardware platformHello all,
I have used MATLAB with the deep learning toolbox to train my own Faster RCNN object detector.
Either if I use a predefined CNN (squeezenet for example) or my designed CNN, I want to export the trained Faster RCNN to use it on other embedded platforms.
exportONNXNetwork gives errors with Faster RCNN architectures no matter the CNN used.
How can I export my work to use it in another HW? I have worked many hours and now I can not deploy my design !!
Thank you all in advance,
AlbertoAlberto Tellaechehttps://au.mathworks.com/matlabcentral/profile/authors/14940416-alberto-tellaechetag:au.mathworks.com,2005:Question/4862342019-10-19T03:08:34Z2019-10-19T15:31:22Zhow can i generate the random numbers for specific probabilitesHello everyone.
I need to choose a random number for each probablitiy. The code is in the attachment. The code is perfect, i just need a random number for each probability.
Its really confusing for me. So if somebody can help me to solve ths problem, i will be very thankfull..
Thanks
waqas muhammadhttps://au.mathworks.com/matlabcentral/profile/authors/10242532-waqas-muhammadtag:au.mathworks.com,2005:Question/4862392019-10-19T04:16:34Z2019-10-19T15:25:54ZError using - Matrix dimensions must agree. please I will be grateful for any help for this error:
Error using -
Matrix dimensions must agree.
Error in tvf_emd (line 136)
temp_x = temp_x-y(ind_remov_pad);
the code is below:
if flag_stopiter
imf(nimf,:)=y(ind_remov_pad);
temp_x = temp_x-y(ind_remov_pad);
break;
endYussif M. Awelisahhttps://au.mathworks.com/matlabcentral/profile/authors/13640172-yussif-m-awelisahtag:au.mathworks.com,2005:Question/4862962019-10-19T15:18:44Z2019-10-19T15:18:44ZTime series for Z-scores on a gridHi all,
I am tyring to display a timeseries analysis for a gridded data, In x=141 y=71 and t=38. I calculated the Z-values for the 38 years but when I am trying to do the time series I am getting the following errors. Any help will be appreciated I'm new on matlab and Im tying to learn it.
rainz1 = timeseries(rainz(:,1),1:71);
rainz1.Name = 'Rain z score';
rainz1.TimeInfo.Units = 'years';
plot(rainz1,':b')
grid on
Error using timeseries.utreshape (line 886)
Data and time dimensions are incompatible.
Error in timeseries/init (line 298)
[data,quality] = timeseries.utreshape(lenTime,data,quality);
Error in timeseries (line 343)
this = init(this,varargin{:});
Error in hw31 (line 29)
rainz1 = timeseries(rainz(:,1),1:71);Emmanuel Gonzalez-Figueroahttps://au.mathworks.com/matlabcentral/profile/authors/15423469-emmanuel-gonzalez-figueroatag:au.mathworks.com,2005:Question/4862902019-10-19T14:59:08Z2019-10-19T15:18:03Zexp(A) gives zero in the first argumentWhen I compute for example
exp([71 307])
on matlab (on my laptop version) I get
ans =
1.0e+133 *
0.0000 2.1301
Which seems pretty unreasonable to me as 71 is not that big and of course not bigger than 307.
Also if I put the same computation on octave online I get
ans =
6.8377e+30 2.1301e+133
which makes tottaly sense.
Do you know what is going wrong?Antonios Nasioulashttps://au.mathworks.com/matlabcentral/profile/authors/7854750-antonios-nasioulastag:au.mathworks.com,2005:Question/179312011-10-10T20:17:48Z2019-10-19T15:14:25ZBairstow Method to find polynomial roots matlab code problemHello Experts,
I need matlab code of the Bairstow method to find polynomial roots.
I have found here on our site a guy who wrote such function - John Penny ( <http://www.mathworks.com/matlabcentral/fileexchange/2305-numerical-methods-using-matlab-2e/content/edition2/na_funcs/bairstow.m>). But when you use it with the simple polynomial coeff vector A = [1,-6,11,-6] (roots: 1,2,3) you don't get the right roots.
Please help me, I need it urgently to customize at work and that's why I need the correct code.
Here is the full function:
function [rts,it]=bairstow(a,n,tol)
% Bairstow's method for finding the roots of a polynomial of %degree n.
%
% Example call: [rts,it]=bairstow(a,n,tol)
% a is a row vector of REAL coefficients so that the
% polynomial is x^n+a(1)*x^(n-1)+a(2)*x^(n-2)+...+a(n).
% The accuracy to which the polynomial is satisfied is given by tol.
% The output is produced as an (n x 2) matrix rts.
% Cols 1 & 2 of rts contain the real & imag part of root respectively.
% The number of iterations taken is given by it.
%
it=1;
while n>2
%Initialise for this loop
u=1; v=1; st=1;
while st>tol
b(1)=a(1)-u; b(2)=a(2)-b(1)*u-v;
for k=3:n
b(k)=a(k)-b(k-1)*u-b(k-2)*v;
end;
c(1)=b(1)-u; c(2)=b(2)-c(1)*u-v;
for k=3:n-1
c(k)=b(k)-c(k-1)*u-c(k-2)*v;
end;
%calculate change in u and v
c1=c(n-1); b1=b(n); cb=c(n-1)*b(n-1);
c2=c(n-2)*c(n-2); bc=b(n-1)*c(n-2);
if n>3, c1=c1*c(n-3); b1=b1*c(n-3); end;
dn=c1-c2;
du=(b1-bc)/dn; dv=(cb-c(n-2)*b(n))/dn;
u=u+du; v=v+dv;
st=norm([du dv]); it=it+1;
end;
[r1,r2,im1,im2]=solveq(u,v,n,a);
rts(n,1:2)=[r1 im1]; rts(n-1,1:2)=[r2 im2];
n=n-2;
a(1:n)=b(1:n);
end;
%Solve last quadratic or linear equation
u=a(1); v=a(2);
[r1,r2,im1,im2]=solveq(u,v,n,a);
rts(n,1:2)=[r1 im1];
if n==2
rts(n-1,1:2)=[r2 im2];
end;
function [r1,r2,im1,im2]=solveq(u,v,n,a);
% Solves x^2 + ux + v = 0 (n 1) or x + a(1) = 0 (n = 1).
%
% Example call: [r1,r2,im1,im2]=solveq(u,v,n,a)
% r1, r2 are real parts of the roots,
% im1, im2 are the imaginary parts of the roots.
% Called by function bairstow.
%
if n==1
r1=-a(1);im1=0; r2=0; im2=0;
else
d=u*u-4*v;
if d<0
d=-d;
im1=sqrt(d)/2; r1=-u/2; r2=r1; im2=-im1;
elseif d>0
r1=(-u+sqrt(d))/2; im1=0; r2=(-u-sqrt(d))/2; im2=0;
else
r1=-u/2; im1=0; r2=-u/2; im2=0;
end;
end;Stevehttps://au.mathworks.com/matlabcentral/profile/authors/2357347-stevetag:au.mathworks.com,2005:Question/3971142018-04-24T17:06:39Z2019-10-19T14:56:10ZWildcard or multiple conditions on switch/case?Hello,
Is there a way to deal with multiple conditions in switch/case? For example (this is just example):
* Meat could be chicken pork beef lamb
*
* Veggie could be beans peas corn
*
* Fruit could be apple pear blueberry
Looking for a way to then select for each possible combination. Is the easiest way just nested switch/case? Or is there something more elegant? Is there an easy way to use case wildcards (not great for this example)?
Thanks!
DougDouglas Andersonhttps://au.mathworks.com/matlabcentral/profile/authors/4227986-douglas-andersontag:au.mathworks.com,2005:Question/4862722019-10-19T11:40:28Z2019-10-19T14:39:13Zhow can I limit the search for kNN (fitcknn) if I have multiple classes in training but just want to compare the distance to few classesHello to all,
how can I limit the classes to few selected.
suppose we have: Bending; Sitting; Standing; FAlling; Walking
in the training
but I just want to compare is it Bending or Walking
while i is the sample and m is the class (five in total) and x is the image
mdl_MD = fitcknn(P_train,movs(trainIdx),'NumNeighbors',3,'Distance','euclidean');
predict(P_train,P_test)
It computes the distance to all classes but I want the distance just to two as I said without computing a new .
I assume this must be possible with the functions fitcknn or predict, but how.
Thank you in advanced for your help.Ronny Guendelhttps://au.mathworks.com/matlabcentral/profile/authors/12085977-ronny-guendel