https://www.mathworks.com/matlabcentral/answers/questionsMATLAB Answers — New Questions2019-11-19T09:03:11Ztag:www.mathworks.com,2005:Question/4912382019-11-15T08:36:40Z2019-11-19T09:03:11Zproblem when i starting simulink in Matlab2019aAltantsooj Batsukhhttps://www.mathworks.com/matlabcentral/profile/authors/15163757-altantsooj-batsukhtag:www.mathworks.com,2005:Question/4917282019-11-18T15:54:46Z2019-11-19T09:00:56ZSymbolic tool box - Equation in desired formHi,
How can I tell matlab to give me the result in desired form.
I'm using symbolic tool box.
For example, I got following transfer function from the symbolic tool box calculation
G=D*R*1/(C*L*R*s^2+L*s+R)
but I want matlab to represent the same function as follows
G=G_s*1/(1+s/(Qω_c )+(s/ω_c )^2 )
Where
G_s=D
ω_c=1/√LC
Q=R*√(C/L)
Also find the attached.
Thanks.
Jochen Baierhttps://www.mathworks.com/matlabcentral/profile/authors/8404268-jochen-baiertag:www.mathworks.com,2005:Question/4840042019-10-07T14:15:13Z2019-11-19T08:59:33ZUse unique on a cell array containing two columnsHello,
I keep on getting this error when applying the unique function to my data. The data consits of a cell array with two column which are different compination of brainregion.
This is the error I get:
Unable to group rows using unique values of the table variable 'BRAINREGION' because it is a cell array with more than one column.
My code:
GroupingVariables3 = {'BRAINREGION'};
[DataTable3,~,ix3] = unique(DataTable(:,GroupingVariables3),'rows');
I hope someone can help :)Hinna Ahmedhttps://www.mathworks.com/matlabcentral/profile/authors/6904558-hinna-ahmedtag:www.mathworks.com,2005:Question/4914702019-11-16T20:19:48Z2019-11-19T08:58:43ZSimultaneous differential equations - derivative of y^3 wrt tI have been trying to solve this problem for sometime and so far I have received an answer that requires the symbolic toolbox which I dont have - I would appreciate any help!
I need to solve these 2 differential equations simultaneously.
But I dont know how to code the dr*^3/dt. My code is below:
function dydt=odefcnNY_v3(t,y,D,Cs,rho,r0,N,V,Af)
dydt=zeros(2,1);
dydt(1)=(-3*D*Cs/rho*r0^2)*y(1)*(1-y(2));
dydt(2)=(D*4*pi*N*r0*(1-y(2))*y(1)-(Af*y(2)))/V;
end
y(1) = r* and
y(2) = C*
So
dydt(1) = dr*/dt and
dydt(2) = dC*/dt
In my case dydt(1) needs to be replaced with something that would solve dr*^3/dt and not dr*/dt. The rest of the code is below.
D=4e-9;%m2/s
rho=1300; %kg/m3
r0=10.1e-6; %m dv50
Cs=0.0016; %kg/m3
V=1.5e-6;%m3
W=4.5e-8; %kg
N=W/(4/3*pi*r0^3*rho);
Af=0.7e-6/60; %m3/s
tspan=[0 24*3600]; %s in 24 hrs
y0=[r0 0];
[t,y]=ode45(@(t,y) odefcnNY_v3(t,y,D,Cs,rho,r0,Af,N,V), tspan, y0);
plot(t/3600,y(:,1),'-o') %plot time in hr, and r*
xlabel('time, hr')
ylabel('radius,um')
legend('DCU')
plot(t/3600,y(:,2),'-') %plot time in hr, and C*
xlabel('time,hr')
ylabel('C* (C/Cs)')
legend('DCU')Nora Rafaelhttps://www.mathworks.com/matlabcentral/profile/authors/2784805-nora-rafaeltag:www.mathworks.com,2005:Question/4918472019-11-19T08:19:14Z2019-11-19T08:58:40Z work with numbers in numberHello! I have the number 40.201109, I need to work with numbers 109, and then with 110 and at the end of 40. Help me how to separate themLev Mihailovhttps://www.mathworks.com/matlabcentral/profile/authors/15690204-lev-mihailovtag:www.mathworks.com,2005:Question/4918502019-11-19T08:30:03Z2019-11-19T08:58:37ZHow can I change the lamp color while the application is running?Hi everybody!
I want to inroduce a lamp in my applycation, that shows the status of the application.
-Grey: introducing data.
-Red: calculating.
-Green finished.
The PROBLEM is that while the aplication is running the lamp color doesn´t change. When introducing the data it is grey, as it is set, but when I press the calculation button, it doesn`t change color to red, even if it is the first comand in the code. It seems like the application cannot send the order in real time.
I tried the following and no one worked:
Switch command.
Lamps states.
Internal function.
Any suggestion to get the lamp red while runnig and green when finished?
Thanks!Esteban Zubiriahttps://www.mathworks.com/matlabcentral/profile/authors/14436049-esteban-zubiriatag:www.mathworks.com,2005:Question/4918582019-11-19T08:56:34Z2019-11-19T08:56:34ZIndex exceeds the number of array elements (35). plz rewrite the code after solve mistakex=0:6
Ta=30.2
To=69.0
k=0.04
e=1.04
y=Ta+(To-Ta)*e.^(x*(-k))
y2=log(y-Ta)
subplot(1,2,1)
plot(x,y)
xlabel=('estimated time--->')
ylabel=('tempertureT--->')
title=('temperature vs estimated time graph')
subplot(1,2,2)
plot(x,y2)
xlabel=('time--->')
ylabel=('log(T-Ta)--->')
title('log(T-Ta) vs time graph')
Jeel Khatiwalahttps://www.mathworks.com/matlabcentral/profile/authors/16343670-jeel-khatiwalatag:www.mathworks.com,2005:Question/4918572019-11-19T08:55:13Z2019-11-19T08:55:13Zchange the number of bins in corrplot function?Hello,
Is there anyway to change the number of bins in corrplot function? I would like to use 10 bins instead let MATLAB choose it. Yaser Khojahhttps://www.mathworks.com/matlabcentral/profile/authors/8998848-yaser-khojahtag:www.mathworks.com,2005:Question/4912902019-11-15T14:29:12Z2019-11-19T08:54:44ZHow to open this exampleHow to open this example:
https://it.mathworks.com/help/physmod/sps/examples/pre-parameterized-stepper-motor-block-validation.html
best regards, Emanuele.EMANUELE GUAGLIANOhttps://www.mathworks.com/matlabcentral/profile/authors/12328555-emanuele-guaglianotag:www.mathworks.com,2005:Question/4917712019-11-18T20:20:28Z2019-11-19T08:54:38Zset a pic in GUIHi,
I need help on the following matter:
I am desgning a GUI and I would like to set a PIC that when the user open the GUI it will appear only for few seconds, then the GUI intrface will start.
It is just like a welcoming pic.
I used the following command to convert the pic to fig
img = imread('~~.jpg');
imshow(img);
savefig('~~~.fig');Abdullah Alraigihttps://www.mathworks.com/matlabcentral/profile/authors/15109249-abdullah-alraigitag:www.mathworks.com,2005:Question/1673662014-12-20T19:33:21Z2019-11-19T08:54:05ZHow to measure circularity??How to measure circularity ? What is wrong in this code?
CC=bwconncomp(BW); %BW binary image
labeled=labelmatrix(CC);
stats = regionprops(CC, 'all');
stats.circularity = ((stats.Perimeter) .^2 )./ (4*(pi*(stats.Area)))
<</matlabcentral/answers/uploaded_files/22835/im.jpg>>
Nisreen Sulaymanhttps://www.mathworks.com/matlabcentral/profile/authors/3612391-nisreen-sulaymantag:www.mathworks.com,2005:Question/4918562019-11-19T08:47:12Z2019-11-19T08:53:08ZIndex exceeds the number of array elements (35).x=0:6
Ta=30.2
To=69.0
k=0.04
e=1.04
y=Ta+(To-Ta)*e.^(x*(-k))
y2=log(y-Ta)
subplot(1,2,1)
plot(x,y)
xlabel=('estimated time--->')
ylabel=('tempertureT--->')
title=('temperature vs estimated time graph')
subplot(1,2,2)
plot(x,y2)
xlabel=('time--->')
ylabel=('log(T-Ta)--->')
title('log(T-Ta) vs time graph')
Jeel Khatiwalahttps://www.mathworks.com/matlabcentral/profile/authors/16343670-jeel-khatiwalatag:www.mathworks.com,2005:Question/4400842019-01-16T16:28:13Z2019-11-19T08:52:48Zpdepe help! (boundry condition in PDE solver)Hello, I need some help with differential equation solving in MATLAB.
I need to slove heat-conduction equation: Cρ*dT(x,t)/dt = df(dT(x,t)/dx)/dx.
Boundry condition: T(x,0)=T0; dT(L,t)/dx=0; T(0,t) = Tg(t) [is the upper boundary condition and, (here, Tg is an instrument-recorded temperature)]
However, the boundary conditions Tg(t) are not periodic(Temperature is changed with time and have no fixed transform relation with time).
How can use pdepe to solve it?
Can someone help me??
This is my code:Yizhou Duhttps://www.mathworks.com/matlabcentral/profile/authors/14408367-yizhou-dutag:www.mathworks.com,2005:Question/4918482019-11-19T08:21:10Z2019-11-19T08:52:38ZHow to split numeric values and store them?I have the array below with activities 1, 2 and 3 and the times the system has spent in these activities. Not every row is a new date. For example, the first value (24) is 1/1/2015, however, the two following values (22.3 + 1.7 = 24) is on 1/2/2015, and so on.
Modes2 =
0 0 24.0000
0 0 22.3000
0 0 1.7000
0 0 13.0000
0 11.0000 0
0 24.0000 0
0 24.0000 0
0 24.0000 0
0 24.0000 0
0 17.2833 0
0 3.7667 0
2.9500 0 0
7.1167 0 0
16.8833 0 0
24.0000 0 0
To further analyse these, the need to be stored per 6 hours in something like the following.
Time_periods1 =
1/1/2015 6 hr 0 0 0
1/1/2015 12 hr 0 0 0
1/1/2015 18 hr 0 0 0
1/1/2015 24 hr 0 0 0
1/2/2015 6 hr 0 0 0
1/2/2015 12 hr 0 0 0
1/2/2015 18 hr 0 0 0
1/2/2015 24 hr 0 0 0
1/3/2015 6 hr 0 0 0
1/3/2015 12 hr 0 0 0
1/3/2015 18 hr 0 0 0
1/3/2015 24 hr 0 0 0
1/4/2015 6 hr 0 0 0
1/4/2015 12 hr 0 0 0
I wrote the following, does not work, now I'm lost.
for i=1:size(Modes2,1)
for j=1:size(Time_periods2,1)
for k=1:7
if (Modes2(i,k)>0 && Modes2(i,k)<=6)
Time_periods2(j,k)=Modes2(i,k);
elseif (Modes2(i,k)>6 && Modes2(i,k)<=12)
Time_periods2(j+1,k)=Modes2(i,k)-6;
Time_periods2(j,k)=6;
elseif (Modes2(i,k)>12 && Modes2(i,k)<=18)
Time_periods2(j+2,k)=Modes2(i,k)-12;
Time_periods2(j+1,k)=6;
Time_periods2(j,k)=6;I
elseif (Modes2(i,k)>18 && Modes2(i,k)<=24)
Time_periods2(j+3,k)=Modes2(i,k)-18;
Time_periods2(j+2,k)=6;
Time_periods2(j+1,k)=6;
Time_periods2(j,k)=6;
end
end
end
end
Any ideas?Ymkje Lize Neuteboomhttps://www.mathworks.com/matlabcentral/profile/authors/2105738-ymkje-lize-neuteboomtag:www.mathworks.com,2005:Question/4918412019-11-19T07:02:02Z2019-11-19T08:51:12ZHow to find the row numbers of similar elementsHi,
I needed a little help with finding the row numbers of similar elements in a matrix. It involves the use of unique,find and sort commnds but I could not clear the errors that I was facing. My code should do the following:
I have a matrix as follows:
1 3 2
2 4 1
4 3 6
5 1 8
2 8 9
1 7 5
6 6 2
7 9 1
1 3 2
I need my code to first check for similar values in column 1, for example in the above matrix let us consider for the number "1", it occurs three times in column1. So I want my code to check for all the rows in column 1 with a value 1 and then check for the same rows if the corresponding values in column 2 are also same, meaning in the 1st column above the value 1 occurs on rows 1, 6 and 9, then for the same rows the code should check what are the values in column 2, from the matrix it can be noticed that the corresponding values in column 2 for 1 is 3, 7 and 3. After this I need my code to check for the row numbers of similar elemnts that is 3. From the matrix above it is the row numbers 1 and 9. Then I need the code to check for the values in column 3 for rows 1 and 9, if the numbers in column 3 are same then set a variable to 1 otherwise 0. I need the code in a looping structure since I have to check for 50 values.
Any help or suggestions on how to do it is appreciated.
Thanks.Rashmi Mohan Kumarhttps://www.mathworks.com/matlabcentral/profile/authors/12260533-rashmi-mohan-kumartag:www.mathworks.com,2005:Question/4916942019-11-18T13:00:25Z2019-11-19T08:49:39ZHow to generate a pwm signal with duty cycle 30%How to generate a pwm signal with duty cycle 30% without using any of the source blocks.
Want to use the simulink library but not the blocks present in the sourcesHarsha Nimjehttps://www.mathworks.com/matlabcentral/profile/authors/10653873-harsha-nimjetag:www.mathworks.com,2005:Question/4913602019-11-15T21:03:31Z2019-11-19T08:48:50ZVertically align bottom edge of subplotsThe following code
fig = figure;
alist = [-0.1 1 4];
cp = 0;
for counter = 1:3
a = alist(counter);
fp = [(1+sqrt(1+4*a))/(-2*a) (1-sqrt(1+4*a))/(-2*a)];
fpmin = (abs(fp(1)-cp) < abs(fp(2)-cp))*fp(1) + (abs(fp(1)-cp) >= abs(fp(2)-cp))*fp(2);
fpmax = (abs(fp(1)-cp) >= abs(fp(2)-cp))*fp(1) + (abs(fp(1)-cp) < abs(fp(2)-cp))*fp(2);
ax = axes('Position',[.1+(counter-1)*0.3 0 0.25 1]);
axis equal;
hold on;
fplot(@(x) 1-a*x.^2,'color','k');
fplot(@(x) x,'--','color','b');
plot([fpmax -fpmax -fpmax fpmax fpmax],[fpmax fpmax -fpmax -fpmax fpmax],'color','r');
padding = .4*abs(fpmax);
axis([-abs(fpmax)-padding abs(fpmax)+padding -abs(fpmax)-padding max(abs(fpmax),1)+padding]);
end
produces the following image:
The issue is that MATLAB didn't place the third image correctly. The line of code
ax = axes('Position',[.1+(counter-1)*0.3 0 0.25 1]);
supposedly tells MATLAB to position the bottom left corner of each new axis at a height of 0. But this isn't happening in the third image. I also tried using subplots but that produces the same behavior as seen above. How do I vertically align the three axes along their bottoms, if the 'Position' thing I tried doesn't work?Jason Duvallhttps://www.mathworks.com/matlabcentral/profile/authors/7535784-jason-duvalltag:www.mathworks.com,2005:Question/4918552019-11-19T08:44:04Z2019-11-19T08:44:04Z find the position (number) where the condition was met[~,Y5] = kmeans(X,5,'Distance','cityblock',...
'Replicates',5,'Options',opts);
Hello! I have such a code, it gives me all the necessary values, to the edge of one, of the place (position number) where he took them, is it possible to find out how these numbers (position coordinates) are. For example, [~, Y4] = min (X1) I know Y4 for sure (I need the coordinates)Lev Mihailovhttps://www.mathworks.com/matlabcentral/profile/authors/15690204-lev-mihailovtag:www.mathworks.com,2005:Question/4835652019-10-04T08:41:39Z2019-11-19T08:43:13ZError using R2019b version of the MATLABJust installed R2019b MATLAB.
SDR with AD9361 is attached to the Host machine.
The host machine's IP is set to 192.168.3.1
The radio is attached to 192.168.3.14.
Now I try to run the following matlab code:
"Transmit and Receive LTE MIMO Using Analog Devices AD9361/AD9364"
I get the following error:
Error using matlabshared.internal.ssh2client
Error connecting to SSH server at 192.168.3.14
Error in matlabshared.socutils.internal.ipcorereg.system
Error in matlabshared.socutils.internal.ipcorereg.IPCoreRegWrite/stepImpl
Error in comm.zynqradioshared.base/writeReg
Error in comm.zynqradioshared.base/initRegisters
Error in comm.zynqradioshared.tx/sdrDevPreInit
Error in comm.libiio.AD9361.base_control/configureChanBuffers
Error in comm.libiio.AD9361.base/configureChanBuffers
Error in matlabshared.libiio.base/setupImpl
Error in comm.libiio.AD9361.base_control/setupImpl
Error in comm.libiio.AD9361.base/setupImpl
Error in comm.libiio.AD9361.tx_control/setupImpl
Error in comm.libiio.AD9361.tx/setupImpl
Error in comm.zynqradioshared.tx/setupImpl
Error in comm.libiio.AD9361.tx/transmitRepeat
Error in finalMIMOad9361 (line 168)
transmitRepeat(sdrTransmitter,eNodeBOutput);
Can someone help me to solve this problem? I want to run two SDR connecting
and sending data on the air.jarulhttps://www.mathworks.com/matlabcentral/profile/authors/7422232-jarultag:www.mathworks.com,2005:Question/4918532019-11-19T08:40:03Z2019-11-19T08:40:03ZNon blocking while loop in appdesigner?I want to create a GUI with a continously running while loop as main processing part, while using callbacks and the matlab command prompt
What I want to do, is Start the GUI, do some initialisation and than start a while loop which processes data as quick as possible. (DAQ is done with a timer).
While in this "MainLoop", I want to be able to react to callbacks and most importantly, I want to be able to continue to use the matlab main window.
While I can react to callbacks, Matlab wont process any inputs to the command line while inside the main loop.
I tried 3 different methods to start the main loop, but none works.
The only thing that works is deleting the while loop as the execution function of a periodic timer, however, this is too slow (and unflexible) for the quite short MainLoop.
Is there a way to keep the command prompt working and not using timers?
MainLoop:
function MainLoop(app)
while ~app.StopFlag
app.ProcessingIteration = app.ProcessingIteration +1;
disp(['Iter: ' num2str(app.ProcessingIteration)]);
pause(0.1)
drawnow limitrate;
end
end
Method 1: Direct Start from startupFcn
function startupFcn(app)
app.MainLoop();
end
Method 2: Starting via One-Shot Timer
function startupFcn(app)
app.Timer = timer('ExecutionMode', 'singleShot','Name','MainLoop','StartDelay',2);
app.Timer.TimerFcn = @(~,~)app.MainLoop();
end
Method 3: Starting via Button Press
function ButtonPushed(app, event)
app.MainLoop();
end
Stefanhttps://www.mathworks.com/matlabcentral/profile/authors/9074707-stefantag:www.mathworks.com,2005:Question/4918522019-11-19T08:36:49Z2019-11-19T08:36:49Zmodeling multi functional inverterdifference in modeling pv inverter and a multi functional grid connected inverter?sanjna salimhttps://www.mathworks.com/matlabcentral/profile/authors/15842840-sanjna-salimtag:www.mathworks.com,2005:Question/4916602019-11-18T09:05:52Z2019-11-19T08:35:20ZProblems with serial communication LAUNCHXL_f28379DHi.
I want to use LAUNCHXL_f28379D to communicate with other microprocessor via serial port, so I'm doing some tests and I can't do what I need.
The objective is to use the launchpad to send an specific frame of 8 bytes with a period of a second using SCI_C, to test the proper working I have done a simulink program where the launchpad sends "1 10 2 10 3 10 4 10 5 10" frame (unit 8, with no package header or terminator) and I have connected SCI_C to my PC's USB using an FTDI adapter to monitor what is sending using an specific software. What I receive is this: 06 00 98 80 18 00 98 80 1E 00 98 80 60 00 98 80 (Hex) or ..˜€..˜€..˜€`.˜€ characters.
As you can see the data that I receive isnt 8 bytes and the numbers doesnt coincide.
I will appreciate any help, thanks in advance!
EDIT: I have also tryed to do sending only a number and these are the results:
If I send a "49" (Uint 8) what i receive is "06 0f" (supposedly in hexadecimal)
If I send a "2" (Uint 8) what i receive is "18 00" (supposedly in hexadecimal)
Thanks again!jon iglesiashttps://www.mathworks.com/matlabcentral/profile/authors/9699643-jon-iglesiastag:www.mathworks.com,2005:Question/4917752019-11-18T20:35:01Z2019-11-19T08:33:58ZAccessing field data in nonscalar structure arrayLet's say I have a nested non-scalar structure array,
Patient(1).Vitals.weight = 185;
Patient(1).Vitals.temperature = [98 96 100 101];
Patient(1).Vitals.mood = {'Good'};
Patient(1).Location.state = 'VA';
Patient(2).Vitals.weight = 203;
Patient(2).Vitals.temperature = [97 97 98 99];
Patient(2).Vitals.mood = {'Fair'};
Patient(2).Location.state = 'NC';
Patient(3).Vitals.weight = 190;
Patient(3).Vitals.temperature = [98 99 99 100];
Patient(3).Vitals.mood = {'Bad'};
Patient(3).Location.state = 'CT';
I would like to acess the data, for example creating (a) a vector containing the weights [185 203 190], (b) a cell array containing the states {'VA', 'NC', 'CT'}, and (c) a matrix containing the temperature values [98 96 100 100; 97 97 98 99; 98 99 99 100]. I want to avoid looping through Patient(1), Patient(2), etc. since my real structure array is large. How do I extract the data? Some failed attempts are listed below.
Patient.Vitals.weight
% Expected one output from a curly brace or dot indexing expression, but there were 2 results.
[Patient.Vitals.weight]
% Expected one output from a curly brace or dot indexing expression, but there were 2 results.
Patient(:).Vitals.weight
% Expected one output from a curly brace or dot indexing expression, but there were 2 results.
Any suggestions? Or is there some other data storage form better suited to data extraction? [I am using multilevel nesting because my real structure is an output of xml2struct, and perhaps I could flatten the results, but then I will lose some data organization.]
KAEhttps://www.mathworks.com/matlabcentral/profile/authors/9495793-kaetag:www.mathworks.com,2005:Question/4918512019-11-19T08:33:26Z2019-11-19T08:33:26ZCNN data preparation for equal-size TrainData and TargetDataHere my data, Each one of them have files saved as train_* (* runs from 1 to n) same with target_*
My goal is to train a CNN network from 160x2 Train matrices with the same size at Target.
Toan Danghttps://www.mathworks.com/matlabcentral/profile/authors/14838509-toan-dangtag:www.mathworks.com,2005:Question/4917842019-11-18T21:28:04Z2019-11-19T08:32:49ZRead several large csv and store as separate variablesI have 26 large .csv files that each take a while to load in to Matlab. I would like to be able to read them all in, using one for loop, so that I can leave the loop to run and work on something else while all of the files import. I would like each to be stored as a separate variable.
I have tried this, but the code fails on the last line where I try to read in the .csv using readmatrix() and store it with a name depending on the file that the loop is currently processing. In this example, I choose to start at the 17th .csv file in the folder as I have inspected the first 16 in a past life :-) The .csv files are 7GB otherwise I would attach an example.
directory=('Y:\SoundTrap\PSD Output');
d=dir(fullfile(directory, '*.csv')); %list all .wav files in path folder
files=length(d);
for i=17:files
disp(d(i).name); %display filename
name=d(i).name;
filename=fullfile(directory, d(i).name);
file(i)=readmatrix(filename);
end
There error I get is:
Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.
Error in checkPSDoutput (line 14)
file(i)=readmatrix(filename);
Thanks for your help!Louise Wilsonhttps://www.mathworks.com/matlabcentral/profile/authors/15959472-louise-wilsontag:www.mathworks.com,2005:Question/4515872019-03-04T05:00:00Z2019-11-19T08:31:31ZHow can I merge multiple Polyspace "ps_comments.db" files?How can I merge multiple Polyspace "ps_comments.db" files?
We have multiple developers reviewing code in different results folders and would like to be able to merge these.
MathWorks Support Teamhttps://www.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:www.mathworks.com,2005:Question/4918492019-11-19T08:28:14Z2019-11-19T08:28:14ZSpecrtal Method for Heat EquationI have one dimensional homogeneous heat eqaution.
I want to solve it numerically using by supposing where
Taking time derivative using farward difference method , after combinging I get
, where and A is sparse matrix with on its main diagonal.
I tried to write it in MATLAB, but got wrong answers, please look into my code
clc;clear all;close all;
% problem u_t = beta u_xx% beta 1
% exact solution
%%
u = @(x,t) (4*pi/3)*(((sin(pi*x))*exp(-(pi^2)*t)));
t0 = 0;
tn = 0.8;
x0 = 0;
xn = 1;
dx = 0.0625;
dt = 0.004;
x = (x0:dx:xn)';
t = (t0:dt:tn)';
beta = 1;
s = beta*dt/dx^2;
nx = (xn-x0)/dx;
nt = (tn-t0)/dt;
%% we start indexing from zero
nx_int = nx; % number of interior points in spatial dim
nt_int = nt-1; % number of interior points in temporal dim
%% construction of diagonal matrix
indx1 = ones(1,nx-2);
indx2 = ones(1,nx-1);
v =((1:nx)*pi).^2;
A = full(diag(v,0));
%% boundary conditions
% U(0,k) = 0
% U(20,k) = 0
% initial condition
% int_cond = @(x) sin(pi/4*x).*(1+2*cos(pi/4*x));
%%
fun = @(x) x.*(1-x).*sin((1:nx+1)*pi*x);
q = integral(fun,0,1,'ArrayValued',true);
U=zeros(nx+1,nt+1);
U_exact=zeros(nx+1,nt+1);
U(:,1) = q';
U(1,:)=0;
U(nx+1,:)=0;
% A U(k+1) = U(k) + b
%% numerical solution construction
for k=1:nt_int+1
U(2:nx_int+1,k+1) = U(2:nx_int+1,k)+ dt*A\U(2:nx_int+1,k+1);
end
%% exact solution construction
for k=1:nt+1
U_exact(1:nx+1,k) =u(x,t(k));
end
Numerical_sol = U;
Analytical_sol = U_exact;
%Plots
figure(1)
subplot(2,2,1)
mesh(t,x,U)
xlabel('Temporal dim')
ylabel('Spatial dim')
zlabel('Numerical sol')
subplot(2,2,2)
mesh(t,x,U_exact)
xlabel('Temporal dim')
ylabel('Spatial dim')
zlabel('Analytical sol')
subplot(2,2,3)
mesh(t,x,U_exact-U)
xlabel('Temporal dim')
ylabel('Spatial dim')
zlabel('Error in sol')
and tell me my mistake.
Thanks
Muhammad Usmanhttps://www.mathworks.com/matlabcentral/profile/authors/1613763-muhammad-usmantag:www.mathworks.com,2005:Question/4917042019-11-18T13:56:25Z2019-11-19T08:27:37ZDeleting Elements in FEM by using a threshold Hello everybody,
i have some grooves and i need to delete elements in these grooves if the gap width is larger than 2.5 mm.
how can i extract and delete the elements in the groove by using the length of the elements ? all i have is the nodes, the elements and a neighbourmap which shows me which element is my neighbour in the x,y or z direction.
Betim Bahtirihttps://www.mathworks.com/matlabcentral/profile/authors/11290217-betim-bahtiritag:www.mathworks.com,2005:Question/4757912019-08-12T09:15:23Z2019-11-19T08:17:06ZError using Simulink, can't even make new model or open an existing oneThe error says the following
Onkar Singhhttps://www.mathworks.com/matlabcentral/profile/authors/15292728-onkar-singhtag:www.mathworks.com,2005:Question/4917942019-11-18T22:56:47Z2019-11-19T08:15:03ZThe splitting text contains file into separate columnshi i have text files contains strings and number , i need seperate the string from numbers into excel columns file :
as in attache file:
example :
system.mem_::UNDEFINED 1713974500 # Cumulative ticks
system.cpu05.kern.ipl_ticks::31 6939000 0.77% 100.00% # number of
so i need put them in seperate culumns as following :
Col A Col B Col C Col D Col E Col H
system.mem_::UNDEFINED 1713974500 #Cumulative ticks
system.cpu05.kern.ipl_ticks:: 31 6939000 0.77% 100.00% # Number of
i used import file by matlab : but it seperate only into two cloums such as this :
A B
system.mem_::UNDEFINED 1713974500 # Cumulative ticks
I appriciate for any help !
Furat Alobaidyhttps://www.mathworks.com/matlabcentral/profile/authors/6214076-furat-alobaidytag:www.mathworks.com,2005:Question/4918202019-11-19T03:26:47Z2019-11-19T08:10:52Zuitable does not accept two dothello,
i'm new to the matlab (uitable). i'm writing a code with two uitable and i want to read from excel file and then edit in the table then write to excel file the new data . every things are working except i can't write a number in the uitable like this '192.168.210.230' (WITH TWO DOTS ) how can i make the uitable accept this kind of value like ip address?
here is my code:
function startupFcn(app)
app.UITable.ColumnName={'Colume_1'};
t = app.UITable;
P= app.UITable2;
P.ColumnName={'IP_ADDRESS'};
set(t,'data',ones(28,1))
set(P,'data',ones(2,1))
app.UITable.RowName={'z1';'z2';'z3';'z4';'z5';'z6';'z7';'z8';'z9';'z10';'z11';'z12';...
'z13';'z14';'z15';'z16';'z17';'z18';'z19';'z20';'z21';'z22';'z23';'z24';'z25';'u';'v';'w' };
P.RowName={'IP_CAMERA';'IP_ROBOT'};
set(t,'ColumnWidth',{200})
set(t,'ColumnEditable',logical([1]))
set(P,'ColumnWidth',{500})
set(P,'ColumnEditable',logical([1]))
t.Data(:,1) = 0;
P.Data(:,1) = ' ';
t.Data= xlsread('sos.xlsx',('A1:A28'));
P.Data= xlsread('sos.xlsx',('B1:B2'));
and for push button in order to save the new data :
function pushtosaveButtonPushed(app, event)
t = app.UITable;
P= app.UITable2;
l= get(t, 'data');
f=get(P, 'data');
xlswrite('sos.xlsx', l,('A1:A28'))
xlswrite('sos.xlsx', f,('B1:B2'))
end
endnaouras salehhttps://www.mathworks.com/matlabcentral/profile/authors/14021404-naouras-salehtag:www.mathworks.com,2005:Question/4918452019-11-19T08:04:15Z2019-11-19T08:05:09ZPolyspace Bug Finder Report no line number showI saw from the generated xml file from bugfinder.rpt, the table does not indicating the line number in the source code where the defect occurs. And i run another similar report generation in code_prover with developer.rpt it does show the line number.
How i can achieve similar table as code prover report with line number?
BTW i am using r2013b matlabKang Sheng Wonghttps://www.mathworks.com/matlabcentral/profile/authors/14831540-kang-sheng-wongtag:www.mathworks.com,2005:Question/4918462019-11-19T08:04:31Z2019-11-19T08:04:31ZThe output of 'chart XYZ' cannot be logged because this block is a Simulink function within Stateflow or a MATLAB Function block. But no signal is logged.I'm using Matlab/Simulink 2018b and my model is not runnable. The following error appears: The output of 'path of chart XYZ' cannot be logged because this block is a Simulink function within Stateflow or a MATLAB Function block. Even though no signal is logged. I don't know how to localize the issue. Befor puschen the model to the lib it was working fine. How can I fix the issue?
Jan Jansenhttps://www.mathworks.com/matlabcentral/profile/authors/16029645-jan-jansentag:www.mathworks.com,2005:Question/4915542019-11-17T14:32:15Z2019-11-19T07:59:12ZAnyone that can find what is wrong about the function? It says " Not enough input values" but I can not see which values I have missed? Can you?
Linnéa Aronssonhttps://www.mathworks.com/matlabcentral/profile/authors/16767410-linnea-aronssontag:www.mathworks.com,2005:Question/2925702016-06-28T02:52:30Z2019-11-19T07:57:47ZHow to get textscan working with YY-MM-DD data?I have a text file 'bankaccounttime.txt' with contents:
151215
151216
There is a blank line after the last entry, but the problem results even if I delete it. (Dates refer to 2015 December 15th, 2015 December 16th, but I intend to convert the entire column to serial date numbers via |datenum| and append the result to another time text file.)
Why does this command yield the following error? How do I fix it?
code:
bankaccounttime = textscan('data/bankaccounttime.txt','%{yMd}D')
error:
Error using textscan
Unable to read the DATETIME data with the format 'yMd'. If the data is
not a time, use %q to get string data.Daniel Bridgeshttps://www.mathworks.com/matlabcentral/profile/authors/7430754-daniel-bridgestag:www.mathworks.com,2005:Question/4915722019-11-17T17:09:19Z2019-11-19T07:56:15ZUsing existing arrays in workspaceHello,
I am currently writing some code which finds the eigenstates of a Hamiltonian, but each time I run the code I need to solve a nonlinear differential equation. The solutions of this equation are saved into an array in the workspace.
I need to trouble shoot the code constantly, so it is annoying waiting for this nonlinear equation to be solved, and I need a fairly fine mesh to get my code working properly, so I am wondering if there is a way for me to bypass the boundary value problem solver and just take the existing solution out of my work space provided it is already there?
I appreciate any help I can get!
-Marcus
*I should also add I am just commenting out the line which uses bvp4c after I get the solution in the workspace, but would like to know if there is an automatic way to do this.Marcus Rosaleshttps://www.mathworks.com/matlabcentral/profile/authors/7835065-marcus-rosalestag:www.mathworks.com,2005:Question/4884232019-10-31T00:03:20Z2019-11-19T07:50:50ZUnable to post to Thingspeak channelOkay, I've tried a few different ways to post to any channel I've created but haven't had any success. I'm going to throw up a channel for anyone else to try and post to just in case I'm doing something way wrong. Originally I tried to post temerature data from a nodemcu/esp8266 and when that didn't work I set up another channel and used Postman to try and send data. That didn't work either. I can do GET requests to see channel info but I can't get any data to post to the channel. Any help is appreciated.
I made a test channel and made it public just to see if anyone can post to it. It's just a single field and on a free account so don't go crazy.
https://thingspeak.com/channels/897564
write: KYY2MERT251RV2OM
read: S325VXRJTWDUZQRI
Postman:
GET https://api.thingspeak.com/channels.json?api_key=XXXXXXXXXXXXXXXXX (Not sharing my account key but JSON results show the channel)
[
{
"id": 897564,
"name": "testCount",
"description": "",
"latitude": "0.0",
"longitude": "0.0",
"created_at": "2019-10-29T23:06:45Z",
"elevation": "",
"last_entry_id": null,
"public_flag": true,
"url": "",
"ranking": 30,
"metadata": "",
"license_id": 0,
"github_url": null,
"tags": [],
"api_keys": [
{
"api_key": "KYY2MERT251RV2OM",
"write_flag": true
},
{
"api_key": "S325VXRJTWDUZQRI",
"write_flag": false
}
]
}
]
Tried both the GET and POSTMAN tutorials here with no luck: https://www.mathworks.com/help/thingspeak/writedata.html
Any attempt to use a GET or POST to update the channel (field1) results in a return of '0' or 401, which I think means that Thingspeak is not recognizing my write API key. I've had the same problem on multiple channels.
Much appreciate any help. Please let me know if you need more information.Jacob Warnerhttps://www.mathworks.com/matlabcentral/profile/authors/16705033-jacob-warnertag:www.mathworks.com,2005:Question/4918442019-11-19T07:45:09Z2019-11-19T07:45:09Zmatlab is stuck when using logical operators My simulink file has some conditions checking using logical operators and if condition using switch block.But after running , file is stuck and not able even to end task using task manager.
Please anyone help me to figure out thi sissue.these conditions are meant to check alwyas during the time of simulations .neethu nobinhttps://www.mathworks.com/matlabcentral/profile/authors/15064601-neethu-nobintag:www.mathworks.com,2005:Question/4918432019-11-19T07:39:47Z2019-11-19T07:39:47ZRun a Matlab file via a jar file under LinuxHey, i am runing in Linux a jar file which calls a Matlab file(that was developed by someone else).
the Matlab folder starts opening and immediatly closes. when i open the Matlab directly from terminal it works as it should, why via jar filr it breaks??
my code to runing matlabFile in java:
Runtime.getRuntime("gnome-terminal -e ./matlabFile")Livnat Hazahttps://www.mathworks.com/matlabcentral/profile/authors/16893132-livnat-hazatag:www.mathworks.com,2005:Question/4918422019-11-19T07:39:42Z2019-11-19T07:39:42ZProgram TMS320F2837D launch pad XLHow to configure simulink project to program TMS320F2837D launch pad XL, I am beginner so If someone could help me from scratch It would he great help. I a geting error while generating the C code line taget configation not found downlod CCS, TI controlsuit.shivashankar chttps://www.mathworks.com/matlabcentral/profile/authors/13209362-shivashankar-ctag:www.mathworks.com,2005:Question/3376212017-04-27T12:16:54Z2019-11-19T07:39:18ZSensitivity Analysis: Error while calling Generate Random Parameter Values dialog boxDear All,
I am trying to use the sensitivity analysis toolbox that comes with matlab 2016b.
I managed to prepare all required steps in order to run one analysis.
But now, when I am trying to adjust the existing parameter setsIi keep on getting the following error:
Instead of opening the dialog it just pops up another tab with all previous generated values.
in the command window of matlab the following error message occurs:
Warning: Error occurred while executing the listener callback for event ListItemSelected defined for class toolpack.component.TSDropDownPopup:
Error using message
Error filling holes for Controllib:gui:ParamGenerateTabSamplingComboAll. Number 38443359375000003000.000000 not supported as an argument to message
catalog.
Error in ctrlMsgUtils.message (line 8)
mObj = message(ID,varargin{:});
Error in ctrluis.paramui.GenerateParamValueGC/initRadioLabels (line 383)
this.GridAll.Text = ctrlMsgUtils.message(...
Error in ctrluis.paramui.GenerateParamValueGC/setParameterData (line 58)
initRadioLabels(this);
Error in ctrluis.paramui.GenerateParamValueGC (line 43)
setParameterData(this,getParameterData(this.ParentTab));
Error in ctrluis.paramui.ParamTableTab (line 122)
this.GenerateParamValueGC = ctrluis.paramui.GenerateParamValueGC(...
Error in sldodialogs.sensitivityanalysis.SampleSetSection>lCreateSampleSetEditor (line 538)
editor = ctrluis.paramui.ParamTableTab(...
Error in sldodialogs.sensitivityanalysis.SampleSetSection.editSampleSet (line 518)
editor = lCreateSampleSetEditor(saData,wksp,ssetName);
Error in sldodialogs.sensitivityanalysis.SampleSetSection/cbMenuGenerateValues (line 395)
this.ParamTableEditor = this.editSampleSet(ssetName, saData);
Error in sldodialogs.sensitivityanalysis.SampleSetSection>@(hSrc,hData)cbMenuGenerateValues(this,hSrc,btn)
Error in toolpack.component.TSDropDownPopup>LocalListItemSelected (line 110)
obj.notify('ListItemSelected')
Error in hgfeval (line 62)
feval(fcn{1},varargin{:},fcn{2:end});
Error in javaaddlistener>cbBridge (line 52)
hgfeval(response, java(o), e.JavaEvent)
Error in javaaddlistener>@(o,e)cbBridge(o,e,response) (line 47)
@(o,e) cbBridge(o,e,response));
> In toolpack.component.TSDropDownPopup>LocalListItemSelected (line 110)
In hgfeval (line 62)
In javaaddlistener>cbBridge (line 52)
In javaaddlistener>@(o,e)cbBridge(o,e,response) (line 47)
I would be really glad if somenone could help me understanding the issue.
Best regards,
StephanStephan Heidrichhttps://www.mathworks.com/matlabcentral/profile/authors/7660724-stephan-heidrichtag:www.mathworks.com,2005:Question/4918302019-11-19T05:01:39Z2019-11-19T07:35:27ZHow can i automatically switch two inputs after some time delay?Hello,
I am working on one project in which i have two inputs and want one output. As according to my case i need that switching condition in circuit that enables one input at a time and another input after some time delay at which the first one input will remain in off condition. And after the activation of second input, my another circuit will work which should enables the first input and closes the second input. Can anyone help to solve my problem that how should i bulid up the circuitry for this of my condition?
Thank you.Nikita Joshihttps://www.mathworks.com/matlabcentral/profile/authors/16892373-nikita-joshitag:www.mathworks.com,2005:Question/4915992019-11-17T22:56:25Z2019-11-19T07:23:34Zinterp1 fails to interpolate correctly
I have a set of input data which the function interp1 is incorrectly interpolating.
For a statement Vq = interp1(X,V,Xq), I have
X =
-0.0124393747904463
0.0134396235257952
0.0344412390769423
0.0850313641677704
0.0850004675375172
0.126329531171773
V =
-4
-2
0
2
4
6
Clq =
0.0772456107479591
The result interp1 gives me is Vq = 3.3864734865877. This is clearly wrong, but may be related to the face that between V = 4 and V =6, X is not monotonically increasing/decreasing. Can someone help me understand why this is failing?Nate Ballintynhttps://www.mathworks.com/matlabcentral/profile/authors/16393648-nate-ballintyntag:www.mathworks.com,2005:Question/4918342019-11-19T05:56:15Z2019-11-19T07:22:30ZHow do I compare 2 nrrd images out of a CT?So i have 2 .nrrd files, both of a brain CT, one that I previously segmented with a script i made to make the segmentation more automatic, and the other one that I segmented manually in STKSnap, and I need to compare those 2 files and get all the areas in the CT that make an intersection with each other. I have a function to read .nrrd figures, but i haven't still figured it out how to use it.
Here's the .nrrdread function i have:
% Current limitations/caveats:
% * "Block" datatype is not supported.
% * Only tested with "gzip" and "raw" file encodings.
% * Very limited testing on actual files.
% * I only spent a couple minutes reading the NRRD spec.
%
% See the format specification online:
% http://teem.sourceforge.net/nrrd/format.html
% Copyright 2012 The MathWorks, Inc.
% Open file.
fid = fopen(filename, 'rb');
assert(fid > 0, 'Could not open file.');
cleaner = onCleanup(@() fclose(fid));
% Magic line.
theLine = fgetl(fid);
assert(numel(theLine) >= 4, 'Bad signature in file.')
assert(isequal(theLine(1:4), 'NRRD'), 'Bad signature in file.')
% The general format of a NRRD file (with attached header) is:
%
% NRRD000X
% <field>: <desc>
% <field>: <desc>
% # <comment>
% ...
% <field>: <desc>
% <key>:=<value>
% <key>:=<value>
% <key>:=<value>
% # <comment>
%
% <data><data><data><data><data><data>...
meta = struct([]);
% Parse the file a line at a time.
while (true)
theLine = fgetl(fid);
if (isempty(theLine) || feof(fid))
% End of the header.
break;
end
if (isequal(theLine(1), '#'))
% Comment line.
continue;
end
% "fieldname:= value" or "fieldname: value" or "fieldname:value"
parsedLine = regexp(theLine, ':=?\s*', 'split','once');
assert(numel(parsedLine) == 2, 'Parsing error')
field = lower(parsedLine{1});
value = parsedLine{2};
field(isspace(field)) = '';
meta(1).(field) = value;
end
datatype = getDatatype(meta.type);
% Get the size of the data.
assert(isfield(meta, 'sizes') && ...
isfield(meta, 'dimension') && ...
isfield(meta, 'encoding') && ...
isfield(meta, 'endian'), ...
'Missing required metadata fields.')
dims = sscanf(meta.sizes, '%d');
ndims = sscanf(meta.dimension, '%d');
assert(numel(dims) == ndims);
data = readData(fid, meta, datatype);
data = adjustEndian(data, meta);
% Reshape and get into MATLAB's order.
X = reshape(data, dims');
X = permute(X, [2 1 3]);
function datatype = getDatatype(metaType)
% Determine the datatype
switch (metaType)
case {'signed char', 'int8', 'int8_t'}
datatype = 'int8';
case {'uchar', 'unsigned char', 'uint8', 'uint8_t'}
datatype = 'uint8';
case {'short', 'short int', 'signed short', 'signed short int', ...
'int16', 'int16_t'}
datatype = 'int16';
case {'ushort', 'unsigned short', 'unsigned short int', 'uint16', ...
'uint16_t'}
datatype = 'uint16';
case {'int', 'signed int', 'int32', 'int32_t'}
datatype = 'int32';
case {'uint', 'unsigned int', 'uint32', 'uint32_t'}
datatype = 'uint32';
case {'longlong', 'long long', 'long long int', 'signed long long', ...
'signed long long int', 'int64', 'int64_t'}
datatype = 'int64';
case {'ulonglong', 'unsigned long long', 'unsigned long long int', ...
'uint64', 'uint64_t'}
datatype = 'uint64';
case {'float'}
datatype = 'single';
case {'double'}
datatype = 'double';
otherwise
assert(false, 'Unknown datatype')
end
function data = readData(fidIn, meta, datatype)
switch (meta.encoding)
case {'raw'}
data = fread(fidIn, inf, [datatype '=>' datatype]);
case {'gzip', 'gz'}
tmpBase = tempname();
tmpFile = [tmpBase '.gz'];
fidTmp = fopen(tmpFile, 'wb');
assert(fidTmp > 3, 'Could not open temporary file for GZIP decompression')
tmp = fread(fidIn, inf, 'uint8=>uint8');
fwrite(fidTmp, tmp, 'uint8');
fclose(fidTmp);
gunzip(tmpFile)
fidTmp = fopen(tmpBase, 'rb');
cleaner = onCleanup(@() fclose(fidTmp));
meta.encoding = 'raw';
data = readData(fidTmp, meta, datatype);
case {'txt', 'text', 'ascii'}
data = fscanf(fidIn, '%f');
data = cast(data, datatype);
otherwise
assert(false, 'Unsupported encoding')
end
function data = adjustEndian(data, meta)
[~,~,endian] = computer();
needToSwap = (isequal(endian, 'B') && isequal(lower(meta.endian), 'little')) || ...
(isequal(endian, 'L') && isequal(lower(meta.endian), 'big'));
if (needToSwap)
data = swapbytes(data);
endHakin Gutierrezhttps://www.mathworks.com/matlabcentral/profile/authors/16892681-hakin-gutierreztag:www.mathworks.com,2005:Question/4916902019-11-18T12:25:49Z2019-11-19T07:21:06ZTo do arithmetic operations with large arrays going out of memory spaceHi, I am working in code that generates large array values which increases with every iteration of monte carlo simulation. To get accurate result, I need to run the code for large iteration values. However, somehere whlike running, the code stops working stating "out of memory". At the end of the loop I need to perform some arithmatic operation on the values of the array generated. Can you please help me on how can I work with large arrays?manishika rawathttps://www.mathworks.com/matlabcentral/profile/authors/9550983-manishika-rawattag:www.mathworks.com,2005:Question/4366422018-12-20T09:57:11Z2019-11-19T07:20:34ZR2018b gscatter marker issueI just updated to R2018b (from R2017b) and suddenly gscatter plots markers as squares by default.
How can I get back to circles?
(and not by specifying 'Marker' in every instance)Erik Lorentzenhttps://www.mathworks.com/matlabcentral/profile/authors/3814892-erik-lorentzentag:www.mathworks.com,2005:Question/4918402019-11-19T06:54:47Z2019-11-19T07:18:19Zfunction on if and for loopsI am trying to run a function where my input variables are x3 and x4. I am trying to run a code for all positive values of x3 AND x4, the function will computes the ratio x1 divided by x2. I have attempted this through if x+2== x1/x2 but keep seeing error so need some help!! THanksiihttps://www.mathworks.com/matlabcentral/profile/authors/16502257-iitag:www.mathworks.com,2005:Question/4915272019-11-17T08:15:17Z2019-11-19T07:08:09ZBLE can't create characteristic for Arduino serviceI have paired MATLAB with my Arduino nano 33 BLE board over BLE, however when I try to access the custom characteristic by UUID it keep saying
"Device profile has changed. Clear existing ble object with address FD604CB7A70C and recreate it." (code attached)
Any ideas? Thanks
zzhhttps://www.mathworks.com/matlabcentral/profile/authors/9633978-zzhtag:www.mathworks.com,2005:Question/4894692019-11-06T07:27:28Z2019-11-19T07:03:35ZUse XPC Target Scope in seperated modelHey,
I want to use the TargetPC Scope Block. The block is located in a subsystem. If I convert this system into a model (and change top-level models to "one"), the whole model can no longer be compiled. The following error message appears:
Error: File: C:\Program Files\MATLAB\R2018a\toolbox\rtw\targets\xpc\target\build\xpcblocks\tlc_c\scblock.tlc Line: 104 Column: 33 Unable to find RecordType within the CanonicalInputArgDef scope
The problem exists in Matlab 2018a and 2016b. In both versions there is an error message in which CanonicalInputArgDef causes problems in scblock.tlc
The reason why it should be in a model is that the model should support multi-tasking and concurrent-exection.Is there a way to solve the problem? Or, in principle, models with the scope cannot be multi-tasked. steoophttps://www.mathworks.com/matlabcentral/profile/authors/15960606-steooptag:www.mathworks.com,2005:Question/4916542019-11-18T07:10:21Z2019-11-19T07:02:29ZOwn command window for each processI´m working on a project, where a C# process interacts with Matlab via COM. I start the Matlab command window like this:
Type matlabApp = Type.GetTypeFromProgID("Matlab.Application");
matlab = Activator.CreateInstance(matlabApp); %//late binding
It´s working fine so far.
But when I run my application twice, I still only get one Matlab command window where both C# processes share a common workspace which yields in different problems in my application (e.g. race conditions as each process can also change the other´s Matlab variables).
How can i force each process to open its own Matlab command window with its own workspace?
jb179https://www.mathworks.com/matlabcentral/profile/authors/16852582-jb179