https://nl.mathworks.com/matlabcentral/answers/questionsMATLAB Answers — New Questions2020-08-11T05:01:39Ztag:nl.mathworks.com,2005:Question/5745972020-08-03T19:08:33Z2020-08-11T05:01:39ZCalling multiple live scripts from another script does not embed the outputI use Live Scripts to produce relatively standard reports, which take a while to process the input data, and generate embedded output using figures and disp() commands.
I would like to have a main.m script to call a bunch of those Live Scripts, to automatically generate the reports overnight, as in
run('LiveScript1.mlx')
run('LiveScript2.mlx')
...
However, in this case, all the output that should be embedded in the Live Scripts, shows as external figures or in the Commmand Window instead.
If this is a feature, what would be the fix?Joan Vazquezhttps://nl.mathworks.com/matlabcentral/profile/authors/18750297tag:nl.mathworks.com,2005:Question/5776092020-08-10T12:00:36Z2020-08-11T05:00:53ZHow to apply a random Crossover (Arithmetic/Scattered/Two-point) in Genetic Algorithm using auto-generated file from Optimization Toolbox ?I have prepared a code in MATLAB with optimization toolbox which seems to be giving fair results for different optimization functions but at present, accuracy is highly dependent on the type of crossover selected.
To take advantage of different crossover and to improve efficiency, i want to apply a random crossover after every iteration i.e. any of Arithmetic, Scattered or Two-point. How can I do that ?Ankur Shahhttps://nl.mathworks.com/matlabcentral/profile/authors/14208584tag:nl.mathworks.com,2005:Question/407892012-06-10T18:19:44Z2020-08-11T04:56:12ZIs there a way to delete a whole row in a uitable by clicking a delete row button?I would like to know if its possible to delete a row in a uitable (genereted in a GUI) by clicking a push button?
thanks a lot for the help
p.s. I also would like to know if its possible to make up and down buttons, so the selected row can move up one row or down one row?
Smiljanhttps://nl.mathworks.com/matlabcentral/profile/authors/3507681tag:nl.mathworks.com,2005:Question/5779602020-08-11T04:44:56Z2020-08-11T04:52:41ZGerchberg–Saxton algorithm/ Phase Retreiveal algorithmHi, does anyone know any Gerchberg–Saxton algorithm or Phase Retreiveal algorithm (for images) that comes with the error functions that are simple and easy to understand? Do you guys mind sharing it with me or teach me if you guys have it or knows how to do it? I am new to this algorithm and hopping someone can help me on this. I really appreciate for the help, thank you. Soong Wei Kanghttps://nl.mathworks.com/matlabcentral/profile/authors/18480833tag:nl.mathworks.com,2005:Question/5775102020-08-10T08:32:11Z2020-08-11T04:49:43Zhow to create a matrix in a for-loopHello all.
I have 20 participants. After processing their data, I got a table of 1* a number ranging from ... to ... , for each. The unumber of columns is the same number of elecrodes in an EEG file. How can I make one matrix for all participants and then wirte all the data in one excel file (one excel file with the same number of rows as the number of particiopants)? I have written the following. the size of the "outputtable" is different for each person, ranging from ... to 62. Is it possible to write each number under the same "chLabels"?
I thank you in advance.
output_20_participants=[ ] ;
for i=1:20
fileName= soemthing
if exist (fileName)
do this
% Prepare output table
outputTable = array2table(ERP, 'VariableNames', chLabels, 'RowNames', strcat('S',convertCharsToStrings(num2str(i)))); % "ouputTable" is 1*65 table
???
end
end
writetable( output_20_participants, 'test.xlsx','WriteVariableNames', true, 'WriteRowNames', true); %I do not understand the use of "true".!!!Elahehhttps://nl.mathworks.com/matlabcentral/profile/authors/12476322tag:nl.mathworks.com,2005:Question/5766822020-08-07T18:50:49Z2020-08-11T04:47:48Zmatlab start shortcut does not start Clicking the matlab start-shortcut does not start the program (just flashing the DOS like screen, dissapears and nothing moves). 2 hours ago, it worked, but after I used window system recovery, this problem appeared. Toshihiko Makinohttps://nl.mathworks.com/matlabcentral/profile/authors/511603tag:nl.mathworks.com,2005:Question/5779542020-08-11T04:10:20Z2020-08-11T04:46:23ZI want to divide color image in small tiles and then need to count number of color pixels in each tile.I am working on a project and want to divide an image into small tiles (non-overlapping boxes) and then need to count the color pixels as well as the whole pixels in that box. In the end I want to catinate the image of that small tile. Thanks in advance.Atique Khanhttps://nl.mathworks.com/matlabcentral/profile/authors/9466471tag:nl.mathworks.com,2005:Question/4758712019-08-12T18:34:18Z2020-08-11T04:43:34ZSample time settings to read data correctly from SpreadsheetI've created a model in Simulink and Simscape physical system (thermal, thermal liquid). This model needs to be simulated for a duration of a year (365 days). It is important to have a sample time of 3600sec or less. The model includes a set of data inside a spreadsheet (From Spreadsheet block), which has data on an hourly basis (24*365=8760 data sets). When simulating, it is clear that the data read from the spreadsheet are collected as if they include data at a sample rate of 1sec rather than 1 hour. As a result, within 8760 samples the data run out, which is actually after a simulation duration of 8760/60=146min=2.4hours.
No matter how I set up the solver, variable step, fixed step, the sampling rate is the same. I have even experimented with all possible settings in the "From Spreadsheet" block (sample time) but still the same results.
Any ideas on how to set this up so I can simulate for this yearly duration but utilize spreadsheet data every 3600 samples (1hr)?Phivos Koumideshttps://nl.mathworks.com/matlabcentral/profile/authors/14052271tag:nl.mathworks.com,2005:Question/4984372019-12-30T08:31:07Z2020-08-11T04:40:53ZReading accelerometer in ArduinoGood morning. I have to read the x,y,z values of a triple axis accelerometer (BMA220) connected to an Arduino Mega in MATLAB or Simulink. How can I do it?Azzurra Filippinihttps://nl.mathworks.com/matlabcentral/profile/authors/12918697tag:nl.mathworks.com,2005:Question/3923382018-04-03T12:03:08Z2020-08-11T04:34:03ZIs there a spell checker option for MATLAB?I recently started to work with python and PyCharm. As a long time MATLAB user I found it so useful PyCharm has an integrated spell-checker. Not only it make the code much nicer to read, it also helps to prevent coding errors due to misspelling of variables and functions.
Do you know of an option like that for MATLAB?Tom Salomonhttps://nl.mathworks.com/matlabcentral/profile/authors/6005169tag:nl.mathworks.com,2005:Question/5779512020-08-11T03:59:59Z2020-08-11T04:31:31ZRunning .m and simulink (.slx) file togetherI ran in to trouble while working with NI DAQ (USB 6251). I wanted to integrate everything is simulink and they dont provide block for counter (Can't use DIs). So I used function block with coder.extrensic() function and it works but my counter resets everytime. Following is my code,
function data = functionRead1()
data = zeros(1,1); %Preinitialization
coder.extrinsic('daq','addinput','read','table2array'); %define functions as external
d = daq("ni"); % Add DAQ
ch1 = addinput(d, 'Dev1', 'ctr0', 'Position'); % Add Inputs
data = table2array(read(d)); %reads 1 scan cycle and returns accumulated value
end
So the problem is everytime counter resets and I get wront data read in code. Cant use while loop or if...else logic as it goes in loop or throws error.
I have .m file as well for code which works fine. It there any way I can run .m and .slx together on same machine? Or any other solution is fine.
Thanx in advance.Rutvik Shetehttps://nl.mathworks.com/matlabcentral/profile/authors/15872194tag:nl.mathworks.com,2005:Question/4659832019-06-07T09:02:05Z2020-08-11T04:28:24ZHow to run a Simulink Model (.slx) and while loop in (.m file) simultaneously?Hi clever people of the Matlab World,
I came across the following problem and I would greatly appreciate any help/suggestions.
What I built: I have a GUI in which I have implemented a simple state machine. This state machine is being executed in a while loop until a user input stops the loop. The constant refreshing (use of the loop) is necessary, because Audio data gets imported from a ring buffer and manipulated. The GUI runs nicely and stable.
What I want: As an extension to the usability of this tool, I need to run a Simulink model (for inf time) while the while-loop in the gui (.m file) is also running. Common variables for the gui and Simulink has been established and tested.
What the problem is: The Simulink model is being started and runs. As soon as the while loop in the gui (.m file) starts, the Simulink model is not proceeding in time, i.e. the execution time T=... freezes but the "Pause" and "Stop" button still are clickable.
What I tried: Open two instances of MATLAB and try to connect the two instances via the extension "sharedmatrix" by Joshua Dillon. The installation however was unsuccessful. An option I see but dont like is let the two Matlab sessions communicate over I/O files. I also had a look into parpool (Parallel Computing Toolbox) but I reckon this is not really suitable here.
In a nutshell: Is there a way to execute a while loop in a .m file for an unspecified time (until the user stops it) AND let a Simulink model run simultaneously? If not, what are the workarounds?
Thank you very much in advance for spreading ideas and helping me out on this one.Leopold Perceptionhttps://nl.mathworks.com/matlabcentral/profile/authors/15363101tag:nl.mathworks.com,2005:Question/5779572020-08-11T04:27:12Z2020-08-11T04:27:12Zto workspace block logging in real time?Hello
I made a block that logs actual sensor (GPS, IMU) data with Simulink using To workspace.
This sensor operates at 10Hz and logs data every 0.1 seconds when logging through an external program.
(Sensor data value logged by an external program, mSec refers to the fractional data in seconds, not milliseconds.)
To workspace block was used to record sensor data. Simulink settings were set to discrete time settings.
However, when looking at the recorded data through the To workspace block, it was confirmed that logging proceeded at least 60 times faster.
(The recorded data is UTC data of the GPS sensor, and the value corresponding to seconds has been logged more than 60 times.)
Since the sampling time of the To workspace block was set to 0.1s, I thought that I would log data every 10 Hz, which is the actual operation of the GPS sensor, but I faced the problem of logging more than 60 times faster.
I would like to know how to set the To workspace to record data every 10 Hz, which is the actual GPS operation Hz.SangHun Ahnhttps://nl.mathworks.com/matlabcentral/profile/authors/9686587tag:nl.mathworks.com,2005:Question/5770032020-08-08T18:24:50Z2020-08-11T04:24:18ZSolution of natural frequency equation with fzero functionHello every one,
I am solving a Euler-Bernoulli Beam equation for a free vibration system. The beam is supported on an elastic soil. To solve the characteristic equation i have use "fzero" function. while running the code its gave a error massage "Exiting fzero: aborting search for an interval containing a sign change because complex function value encountered during search." so it will be verry help full if any one tell me how to eliminate this error. The matlab coading is as follows,
clc
clear
syms W
L= 60
k=2e7;
m= 2355.069
E=2.07e11;
I=0.01076;
T= 2e3;
R=2e4;
K= (m*W/E*I)^0.25; %W=w^2
A1=R;
A2=E*I*K/L;
A3=R;
A4=-E*I*K/L;
B1=-E*I*K^3/L^3;
B2=T;
B3=E*I*K^3/(L^3);
B4=T;
C1=-E*I*K/L*sin(K)+R*cos(K);
C2=-E*I*K/L*cos(K)-R*sin(K);
C3=E*I*K/L*sinh(K)+R*cosh(K);
C4=E*I*K/L*cosh(K)+R*sinh(K);
D1=-E*I*K^3*cos(K)/(L^3)-T*sin(K);
D2=E*I*K^3*sin(K)/(L^3)-T*cos(K);
D3=E*I*K^3*cosh(K)/(L^3)-T*sinh(K);
D4=E*I*K^3*sinh(K)/(L^3)-T*cosh(K);
H=[A1,A2,A3,A4;B1,B2,B3,B4;C1,C2,C3,C4;D1,D2,D3,D4]
Det=det(H)
f = inline(Det,'W')
for i= 1:100
s(i)= fzero(f, i/5);
end
su=(round((s),7));
output = (su(1:3)/L);
f= (output.^.5)/(2*(22/7))
GOUTAM SARKARhttps://nl.mathworks.com/matlabcentral/profile/authors/18733819tag:nl.mathworks.com,2005:Question/5774742020-08-10T07:37:33Z2020-08-11T04:23:04ZFinding RRI fluctuations (ECG) in 1s windowsThis is the code I am running.
%ECG data
load('Dog_1_interictal_segment_0001.mat')
sf = 399.0698; %sampling frequency (Hz), samples per second
T = 1/sf;
timeSeries = T:T:600.8122;
%filtering
%y filtered data
d = designfilt('lowpassfir', ...
'PassbandFrequency',0.15,'StopbandFrequency',0.2, ...
'PassbandRipple',1,'StopbandAttenuation',60, ...
'DesignMethod','equiripple');
y = filtfilt(d,interictal_segment_1.data(1,:));
%findpeak for y signal in row 1
[pks,locs] = findpeaks(y(1,:),'MinPeakDistance',0.3);
I have found the local max for my signal y(1,:). However i would like to find fluctuations in the signal for successive 1 second, non-overlapping windows. Supposed that peaks 1,2,3,4 are successive local max.
Such that:
fluctuation1=peak2-peak1
fluctuation2=peak3-peak2
fluctuations are counted for a total length of 1 second and data is kept in window.1. Repeat for another 1s and keep data in window.2.
I am new to Matlab so any help is appreciated. Thank you.Shamus Simhttps://nl.mathworks.com/matlabcentral/profile/authors/18704635tag:nl.mathworks.com,2005:Question/5774922020-08-10T08:00:09Z2020-08-11T04:22:44ZCreate a plot for local max peaks given a certain time range.This is the code I am running for an ECG data.
Imagine that
sf = 399.0698; %sampling frequency (Hz), samples per second
T = 1/sf;
timeSeries = T:T:600.8122; %time intervals
% graph with circled peaks (needs debugging)
[pks,locs] = findpeaks(y(1,:),'MinPeakDistance',0.3);
plot(timeseries,y(1,:),timeseries(locs),pks,'or'),xlabel('Time (s)'),ylabel('Amplitude(uV)')
I have a signal y(1,:) with a sampling frequency of 399.0698 and the total length of signal is 600s. Variable timeseries has been concatenated with it on the 2nd row. I have found the local max for the signal y(1,:) I would like to plot a graph such that the peaks are circled and I can choose which part of the signal to show. Example 590-591seconds.
Thank you! Shamus Simhttps://nl.mathworks.com/matlabcentral/profile/authors/18704635tag:nl.mathworks.com,2005:Question/5765082020-08-07T10:42:35Z2020-08-11T04:21:05ZLooking for documentation explaining M.' and other symbols to select data from an arrayI have seen the use of this for getting a row from a matrix M.
M. means the same as M(:,:)
I do find documentation on dot notation but still do not understand the use of the last symbol ' here.
Why do you conjugate to find the rows?
And why can I use T=(M.') or T=(M.)' to give me a conjugated matrix and not T=(M.) to give me the matrix itself?
Can somebody please point me to a documentation page where this is explained, where I can find all symbols used to select parts of an array.
Thanks
Erwin Serléhttps://nl.mathworks.com/matlabcentral/profile/authors/11604539tag:nl.mathworks.com,2005:Question/5779152020-08-11T01:37:00Z2020-08-11T04:19:13ZHow to make an histogram for month with datetime series, the data is windvelocity for a 1 year? Hi everybody, thank you so much for reading me, i really appreaciate, so i have a little problem, is very simple i think, i want to do an histogram for every months, i have my data in datetime, and i have the wind velocity, but i want to know the frequency of the data for months, but i don't know what i can't
this is my code right now:
clear;clc;
numData = xlsread('enerosolar.xlsx','EneDicV')
vel = numData(:,1);
Dia = numData(:,2);
tEnersol=readtable('enerosolar.xlsx','Sheet','EneDicV'); % read into a table object
tEnersol.Properties.VariableNames={'Vel','Dia'}; % assign variable names
yr=2014; % need the proper year
tEnersol.Date=datetime(yr,1,tEnersol.Dia); % and create a date column
tEnersol.Date.Format='dd/MM'; % display date format
hB=bar(tEnersol.Vel); % bar plot in descending order vs ordinal position
hAx=gca; % get axes handle...
xticks(1:7:365) % about all the ticks there's room for...
xticklabels(cellstr(tEnersol.Date(xticks))) % use the date string as tick labels
hAx.XTickLabelRotation=45; % rotate so can have chance to read...
xlabel('Dia del año'), ylabel('Velocidad de viento promedido diaria[m/s]');
perc = hline(2.85154314702398,'r', 'Velocidad de viento promedio '); hold on
perc = hline(2.85154314702398,'r', '2.85 m/s '); hold on
% perc = hline(4,'r', '4-3 m/s'); hold on
% perc = hline(3,'r', '3-1 m/s'); hold on
figure(2)
histogram(day(tEnersol.Vel))
xlabel('Velocidad de viento promedido diaria[m/s]'), ylabel('Cantidad de días del año TMYV');
ax2 = gca;
ax2.XTickLabelRotation = 45;
savefig('histogram.fig');
h = openfig('histogram.fig');
y = findobj(h, 'type', 'histogram')
figure(4)
Thank you so much for your valious time.
Best!!
SophiaAna Sophhttps://nl.mathworks.com/matlabcentral/profile/authors/17227402tag:nl.mathworks.com,2005:Question/5779092020-08-11T00:29:45Z2020-08-11T04:16:53ZHow to pass variable from .m file to appdesigner?Hello,
I have a .m file that I am executing on a button press in appdesigner. The final output of that is a structure variable called "data."
How to I pass "data" into appdesigner so that I can then pass that information within the app?
On another note - I'm having a lot of trouble finding basic tutorials on appdesigner. I used GUIDE in the past, but it doesn't seem to translate very well. Any suggestions?
ThanksDavid Cunninghamhttps://nl.mathworks.com/matlabcentral/profile/authors/11207461tag:nl.mathworks.com,2005:Question/796072013-06-19T19:34:59Z2020-08-11T04:14:49ZAny way to free hand crop an image?Is there any way to free hand crop on an image? I have an organic shape I want to quickly crop not using the rectangular box that matlab has for cropping. Any way to go about this?Siddharthhttps://nl.mathworks.com/matlabcentral/profile/authors/3514023tag:nl.mathworks.com,2005:Question/3876152018-03-11T14:06:07Z2020-08-11T04:12:46Zhow to count data frequency by year and month?Hi, i want to plot a hsitogram count of stations function of Year/month
i have number of station by montn and by year
i have 163x20char indicating name of station and time 163x20char in format dd-mmm-yyyy
station_code:
405,
406,
500,
501,
430
and time: 02-dec-2010,02-dec-2010,20-may-2009, 06-august-2015, 06-sept-2008
any suggestion please Mhttps://nl.mathworks.com/matlabcentral/profile/authors/3951768tag:nl.mathworks.com,2005:Question/5773212020-08-09T19:20:19Z2020-08-11T04:10:57ZFunction implementation matlab languageHi guys, Im coming with background of c/c++/java programming so I've done this function in c++:
uint16_t calc(uint8_t Data, uint16_t Reg)
{
uint8_t i;
unit16_t CRC16_POLY =0x8005;
for (i = 0; i < 8; i++)
{
if (((Reg & 0x8000) >> 8) ^ (Data & 0x80))
{
Reg = (Reg << 1) ^ CRC16_POLY;
}
else
{
Reg = (Reg << 1);
}
Data <<= 1;
}
return Reg;
}
So I want to do the same function but in matlab language, so what I've did is this(still not 100% work and there's a compilation error):
function uint16_t Reg= calc(uint8_t Data, uint16_t Reg)
uint8_t i;
CRC16_POLY =0x8005;
for i = 0:i < 8:i++
{
if ((bitshift((Reg bitwise 0x8000),8) ^ (Data bitwise 0x80)) %if this true then enter the if condition;
{ Reg = bitshift(Reg,1) ^ CRC16_POLY;}
else
{Reg = bitshift(Reg,1);}
bitshift(Data,1); %LEFT SHIFT
}
%once finished from loop for return the Reg variable ..
return Reg;
end
once I implemented that function in matlab I've a compilation error, could anyone please help me to implement properly that function as what I've done in c++? Yeah Im newbie in matlab and thanks alot for any assistance to implement correctly my function in matlab..Jimmy chohttps://nl.mathworks.com/matlabcentral/profile/authors/19144407tag:nl.mathworks.com,2005:Question/5370632020-05-29T02:40:51Z2020-08-11T04:09:29ZBasic Integration from negative infinity to a variableHello all!
I have just started using MATLAB, so do bear with me.
I'm trying to intergerate the following function: exp(-x)*cos(2*pi*t) from negative infinity to t
So what I will is first declare the functionas fun1: fun1 = @(x)exp(-x)*cos(2*pi*t)
After which, I should do this: syms t (not sure what this does too, can anyone explain?)
Then I will do this where r is my output: r = integral (fun1,-Inf,t)
However it givees me an error: Error using integral (line 85)
A and B must be floating-point scalars.
Not sure what I did wrong, can anyone help? Thanks :)H.Whttps://nl.mathworks.com/matlabcentral/profile/authors/15905346tag:nl.mathworks.com,2005:Question/5756292020-08-05T16:01:35Z2020-08-11T04:03:43ZHow to do segmentation on ECG signal for feature extractionI have a 1-minute ECG signal. How do I segment it into 10s? The Fs is 250Hz
thank you in advanced!Mohamad Aswad Bachtear Effendyhttps://nl.mathworks.com/matlabcentral/profile/authors/18497376tag:nl.mathworks.com,2005:Question/5778822020-08-10T23:09:12Z2020-08-11T04:00:42ZHow to concatenate cells in mat file under each other?Hello, I have a .mat file which is comprised of 255 cells. Each cell is a 14 by 65 table. I need to concatenate the tables under each other so that I can have a 14*225 by 65 table at the end. Does anyone know how I can do so in Matlab?Mohammad Rashedihttps://nl.mathworks.com/matlabcentral/profile/authors/19104414tag:nl.mathworks.com,2005:Question/5779482020-08-11T03:55:49Z2020-08-11T04:00:06Zhow to use third party driver in raspberry matlab?I am using raspberry with matlab, I just want to use my desktop computer to communicate with my raspberry through wifi, and raspberry to send the sensor data to my desktop and control 2 dc-motor.(it is a model car with camera).
can matlab call the driver ? or ask raspberry to do so. there is a third party driver to control a dc-motor, they give me python interface, and some *.o file.
I do not know how to call such interface in matlab. So my question is how to run python script in matlab, or *.o file in matlab?(matlab control raspberry to do some control moter)johnhttps://nl.mathworks.com/matlabcentral/profile/authors/965130tag:nl.mathworks.com,2005:Question/5755572020-08-05T14:09:17Z2020-08-11T03:59:44Z"Matlab has disabled some advanced graphic rendering features"I got the following. What is the next step?
t = tiledlayout(1,1,'Padding','none');
Warning: MATLAB has disabled some advanced graphics rendering features by switching to software OpenGL. For more information, click here.
alpedhuezhttps://nl.mathworks.com/matlabcentral/profile/authors/10930090tag:nl.mathworks.com,2005:Question/5779422020-08-11T03:12:23Z2020-08-11T03:56:10Zimportdata cuts my files in half!drct = 'S_up_';
top = importdata(strcat(drct,'200.txt'));
The attached .txt file is 5000 rows tall, but when I use importdata or load, it only loads the first 2500 rows.
There is no header, only straight data. I also tried specifying space delimiter but the problem persists.
So it exactly cuts my data in half, Weird.
version R2016a
Chris Nixonhttps://nl.mathworks.com/matlabcentral/profile/authors/7271190tag:nl.mathworks.com,2005:Question/4946242019-12-03T17:26:06Z2020-08-11T03:54:35Ztab completion with user defined functionI am trying to write a function that takes a .txt file as an input, however the text files have long numerical names therefore I would like to be able to autocomplete them with tab. I have created a json file which I think is correct however when I try to use the function in the command window and tab in any files it just says there are no completions found. I was wondering if anyone can spot what is going wrong?
%json file
{
"output_MT_data":
{
"inputs":
[
{"name":"filename", "kind":"required", "type":"file=*.txt"}
]
}
}
%function file
function output = output_MT_data(filename, counter_start, counter_end)
Table = readtable(filename);
if ~exist('counter_start', 'var')
counter_start = 1;
end
if ~exist('counter_end', 'var')
counter_end = height(Table);
end
output = Table(counter_start:counter_end, 1:4);
endPatrick Osbornehttps://nl.mathworks.com/matlabcentral/profile/authors/8951482tag:nl.mathworks.com,2005:Question/5773992020-08-10T02:33:16Z2020-08-11T03:54:32ZIssues in pca transformationAs I was trying to conduct PCA transformation for testing set based on the training set in Matlab 2019b on a Windows 10 machine, the matrix after PCA transformation seems to be different in 3 different conditions which I originally expect to be identical. I engaged in testing the behavior of pca transformation after I found that the classification accuracy in SVM was not perfectly 50% when the testing set is composed of 2 identical set of data, one coded 1 and another coded 0. That cause my suspection and later I figure that was the problem of the pca transformation I conducted.
%generate training set with normalization per every observation
X=rand(100,50000);
train=zeros(100,50000);
for i=1:100
train(i,:)=normalize(X(i,:));
end
%generate testing set with normalization per every observation
x=rand(10,50000);
test=zeros(10,50000);
for i=1:10
test(i,:)=normalize(x(i,:));
end
%compute pca coefficient based on training set
[coeff,~,latent]=pca(train);
%record if difference exist
allDiff=[]; %reocrd if exist difference among one two and three
tempDiff=[]; %reocrd if exist difference between two and three
%selection of number of pca component to be included in the transformation
for count=1:size(coeff,2)
matrix=coeff(:,1:count);
%cases
one=test*matrix;
temp=[test;test]*matrix;
two=temp(1:10,:);
three=temp(11:20,:);
%comparison on whether the three expectedly identical matrix are indeed identical
if isequal(one,two,three)==false %check if exist difference among one two and three
allDiff=[allDiff,count];
end
if isequal(two,three)==false %check if exist difference between two and three
tempDiff=[tempDiff,count];
end
end
The difference as recorded in allDiff starts at 2 pca component, while that of tempDiff at 20 pca components. Occasionally, some component count will return with identical matrixs among one, two and three.
Is this issue related to the rounding error in matrix multiplication? And more importantly, which is the correct matrix after pca transformation? (I guess that is one) Thanks.Tze Hei Chohttps://nl.mathworks.com/matlabcentral/profile/authors/16758674tag:nl.mathworks.com,2005:Question/5779452020-08-11T03:54:21Z2020-08-11T03:54:21ZDistance measurement between two structures in ImageGood day Matlab Users
I have multiple images to perfom measurements. Could someone please help me on how to automate measurement of distance on axial CBCT images from the chest surface to the edge of the spine below (see attached Figure1c)? Currently I can do the measurement from the chest surface to the center of the image (Fig.1 b) after thresholding the image(Fig. 1a).
Below is my Script for single image (CBCTimage.mat attached)
close all;clear;clc;
II=I>600; % threshold the image
%find the image center
[nx,ny,nz] = size(II) ;
[X,Y] = meshgrid(1:ny,1:nx) ;
O = [mean(X(:)) mean(Y(:))]; % image center
x=[65 65];% define the column where the measuremnts is performed
B=find(II(:,x(1)),1); % find the first black pixel/border along the chest surface
y=[O(2) B];
imshow(II,[]); %show the image
h = imdistline(gca,x,y);
fcn = makeConstrainToRectFcn('imline',get(gca,'XLim'),get(gca,'YLim'));hold on
Dist=y(1)-B % Distance measured
ThanksAUWAL ABUBAKARhttps://nl.mathworks.com/matlabcentral/profile/authors/11386772tag:nl.mathworks.com,2005:Question/5779332020-08-11T02:54:27Z2020-08-11T03:51:17ZAccessing Elements in a 3D matrix using Linear Indexing ?Hello,
I would like to know if it is possible to access the individual element of a 3D matrix of size M*N using linear indexing?Venkata Khambhammettuhttps://nl.mathworks.com/matlabcentral/profile/authors/19123801tag:nl.mathworks.com,2005:Question/5766642020-08-07T18:06:47Z2020-08-11T03:45:42ZData Type Override is automatically enabled when upgrading Simulink VersionsI'm trying to upgrade a legacy simulink model from Matlab 2015b to a more recent version. When I upgrade it to any version more recent than 2016a (I've tried a variety between 2016a and 2019b), the model results change significantly and the diagnostic viewer notifies me that Data Type Override is active on the model.
What exactly does this mean?
How can I identify what Data Type Override is doing?
How can I put a stop to it?
Dhruv Mittalhttps://nl.mathworks.com/matlabcentral/profile/authors/14355290tag:nl.mathworks.com,2005:Question/4875662019-10-26T15:34:30Z2020-08-11T03:45:22ZData Acquisition Toolbox with Simulink: Counter Input ChannelHi,
We are trying to use an NI USB-6009 device to conduct I/O within a Simulink model. The model is already well developed and running on Simulink Real Time with another DAQ, and so we want to change the structure as little as possible. From my understanding, there is no support for the NI device with the Real Time package. Instead, we are trying to implement the data aquisition with the Data Aquisition Toolbox. This will be acceptable as we don't need hard real time and can run the model from a computer with MATLAB/Simulink running.
I need to count pulses from an encoder using the USB-6009 counter channel. I can do this in MATLAB using the following code:
s = daq.createSession('ni');
addCounterInputChannel(s,'Dev1', 'ctr0', 'EdgeCount');
s.inputSingleScan()
What is the equivalent to this in Simulink? The Data Acquisition Toolbox in Simulink does not include a counter input/output block. I find it strange that such a simple function would be available in MATLAB but not implemented in Simulink. When running the first line of the above code in Simulink through a MATLAB function blocks I get the following error:
Function 'createSession' not supported for code generation.
Function 'MATLAB Function' (#35.23.46), line 2, column 5:
"daq.createSession('ni')"Axton Isalyhttps://nl.mathworks.com/matlabcentral/profile/authors/11228345tag:nl.mathworks.com,2005:Question/4968402019-12-16T10:07:31Z2020-08-11T03:45:00Z@-folder and functionSignatures.jsonHi everyone.
I have a classdef file in a certain @-folder. In the same folder I put the folder "resources" containing the "functionSignatures.json" file for the class object I created. Unfortunately when I try to use the autocompletion with an instance of the class object, I don't get any suggestion at all, as if Matlab doesn't find the corresponding functionSignatures.json file.
Example
@MyClass/MyClass.m
@MyClass/resources/functionSignatures.json (containing the function signatures for MyClass.m
but when i type "MyClass(' " and press "tab" I don't get any completions.
If I put the MyClass.m and functionSignature.json file in a NOT @-folder everything works fine.
Any suggestion?Edoardo Ferocinohttps://nl.mathworks.com/matlabcentral/profile/authors/5702911tag:nl.mathworks.com,2005:Question/5774892020-08-10T07:56:28Z2020-08-11T03:41:23ZMaximization function using linear programmingDevi Obligadohttps://nl.mathworks.com/matlabcentral/profile/authors/18924544tag:nl.mathworks.com,2005:Question/5573772020-06-30T17:56:55Z2020-08-11T03:35:00ZWhy does performance of functions saturate with number of cores using parfeval but not with parfor?I am developing an application that MUST take advantage of parallelization, and ideally offer real-time updates after each iteration, which makes use of parfeval prefarable. I believe the algorithm that I have developed is highly parallelizable (see attached for performance of 'WT_Ex_2_b' as a function of number of cores used in parfeval function). From 1 to 8 cores, the speedup factor agrees with theoretical expectation (Amdahl's Law with p=0.95), however, performance of my application saturates at 8 cores. This led me to create a dummy function (see attached script) to compare the performance of using parfor and parfeval as a function of number of cores. I discovered that the parfor version behaves quite similarly to theoretical expectation (Ahmdal's Law, also with p=0.95), however the parfeval version continues to show strange saturation behavior, even for the dummy function. Notice how the Speedup factor improves with core number upto 12 cores, then suddenly no further improvement is observed. I have attached the script in case you want to reproduce this behavior on your end.
Is there a fundamental limitation to the number of cores the parfeval function can leverage? Or is there an obvious mistake I am making in the way I am using the parfeval function? Why does the performance behavior of the dummy algorithm suddenly saturate at 12 cores? Any recommendation how to use the parfeval function to perform as well as parfor?
I would like to emphasize that I have already developed my application to use parfeval, so converting to parfor would be time-consuming and prevent me from utilizing the update-after-iteration feature of parfeval.
Thank you for your help on this critical matter. Joseph Smalleyhttps://nl.mathworks.com/matlabcentral/profile/authors/13751435tag:nl.mathworks.com,2005:Question/5773122020-08-09T18:56:28Z2020-08-11T03:33:31ZUndefined function 'predict' for input arguments of type 'classreg.learning.partition.RegressionPartitionedLinear'.After training model with cross validation:
model{i}=fitrlinear(xtrain',ytrain(i,:)','Crossval','on');
I try to use predict function
predict(model{i},xtest);
This worked fine when i didn't have cross validation flags in the fitrlinear function because the output was linear regression model. I looked on wiki for RegressionPartionedLinear object and its function is also called predict, but matlab giving me "undefined function" error.
How can I use the cross validated model?
Akira Katohttps://nl.mathworks.com/matlabcentral/profile/authors/10925277tag:nl.mathworks.com,2005:Question/926342013-01-03T19:04:00Z2020-08-11T03:32:42ZWhy do I get a connection error when installing or activating MATLAB or another MathWorks product?I get an error that I cannot connect to MathWorks when running the MATLAB installer or the activation client. However, I can access the website. Why can't the activation client connect to the MathWorks?
Connection Error
The application could not connect to MathWorks.
For more information on resolving this issue, see this Support Article.
MathWorks Support Teamhttps://nl.mathworks.com/matlabcentral/profile/authors/4622813tag:nl.mathworks.com,2005:Question/5763012020-08-06T20:25:19Z2020-08-11T03:32:27ZTraining network on non-image dataMajority of examples on deep learning with Matlab cover training a network on images. Could anyone give an example of training on non-image data, please? Say, a curve, defined by two vectors (many curves at different parameters, if speaking of a dataset).Victoria Kurushinahttps://nl.mathworks.com/matlabcentral/profile/authors/17286010tag:nl.mathworks.com,2005:Question/5778792020-08-10T23:07:38Z2020-08-11T03:20:56ZError Message: Output argument "I" (and maybe others) not assigned during call to "simpsons".Hi, so I recently wrote a function
function I = simpsons(f,M,a,b)
h = (b-a)/(M-1);
f = @(x) x;
if rem(M,2) == 0
simpsons1(f,M,a,b)
elseif rem(M,3) == 0
simpsons2(f,M,a,b)
else
simpsons2(f,4,a,3*h) + simpsons1(f,M-3,3*h,b)
end
However, when I call the function in another script, I get the message Output argument "I" (and maybe others) not assigned during call to "simpsons".
This is my script
%i calculating pressure at a given depth
p0 = 101325;
g = 9.81;
for i = 1:1:43
I = 1;
I = simpsons(1,43,0,z(i));
pz = I;
pzm(i) = p0 + I*g;
endMohammad Sirajhttps://nl.mathworks.com/matlabcentral/profile/authors/13410386tag:nl.mathworks.com,2005:Question/5778642020-08-10T22:20:13Z2020-08-11T03:13:15ZFinding min values of third column for rows with similar valuesHi,
I have a Table
2.0000 0 3.1971
1.0000 0 3.1971
3.0000 0 6.4662
1.0000 0 6.4662
3.0000 0 9.6356
2.0000 0 9.6356
2.0000 1 7
1.0000 1 5
3.0000 1 6
1.0000 1 10
3.0000 1 44
2.0000 1 12
Now, what I want is that find minimum value of third column for the first column with equal value in each loop of second column.
Maybe it is better to see the result what I mean.
2.0000 0 3.1971
1.0000 0 3.1971
3.0000 0 6.4662
2.0000 1 7
1.0000 1 5
3.0000 1 6
Really appreciate ahmad Mohammadihttps://nl.mathworks.com/matlabcentral/profile/authors/14439906tag:nl.mathworks.com,2005:Question/5779272020-08-11T02:42:27Z2020-08-11T03:12:51ZI dont know where im going wrong with the codeadj = 20; % ft
opp = 200; % ft
% pythagorus formula a^2+b^2=c^2
c^2 = adj^2+opp^2;
c^2 = sqrt(ans)
Daniel Martellihttps://nl.mathworks.com/matlabcentral/profile/authors/19086907tag:nl.mathworks.com,2005:Question/5759832020-08-06T09:36:45Z2020-08-11T03:10:46ZAccess to class membersHi guys,
I am having some problem in accessing the class members of one class to another class. I have checked in matlab documentation but i didn#t understood it weel. Could anyone help me in understanding it.
classdef clcore
properties(GetAccess=?clMec)
cpc
csc
end
properties(Dependent, GetAccess=?clMec)
ws
end
methods(GetAccess=?clMec)
function ws=get.ws(obj)
ws=obj.cpc+obj.csc;
end
end
end
classdef clMec
properties
Mecmode
end
methods
%
end
end
and in command window
objcore=clcore(1,2)
I knew the way i have done is wrong but my context is this. Could anyone explain me how to use this getaccess.
thankyou.kanuri venkata mohanahttps://nl.mathworks.com/matlabcentral/profile/authors/16764048tag:nl.mathworks.com,2005:Question/5779242020-08-11T01:59:20Z2020-08-11T03:01:07ZMatlab segfaults when I try to access uint32 or int16 data created using a mex functionHi,
I am trying to run some code that was written a while back, but has previously worked for me. I am creating a file using some a function that relies on some mex code (you can see the function here: https://github.com/wilsonlab/mwlIO/blob/master/%40mwleegfile/mwleegfile.m and all the relevant code is in the directory. I am not pasting it here because there are multiple parts and I am unsure if it is the cause of the problem). The file that is created has multiple fields, an example is shown below:
-- EEG FILE OBJECT --
file name : arte_lfp1.eeg
file path :
file mode : read
file type : binary
file size : 684364910 bytes
header size : 2138 bytes
Name Type N
timestamp uint32 [1]
data int16 [16]
-- Interpretation of fields: --
Name Type N
timestamp uint32 [1]
data int16 [8 2]
record size : 36
n records : 19010077
n samples : 2
n channels : 8
If I attempt to access fields such as channels, I get the correct response
eeg_o.nchannels
ans =
8
However, ifi I try to acess EITHER timestamp or data, I get a seg fault.
>> eeg_o.timestamp
--------------------------------------------------------------------------------
Segmentation violation detected at Mon Aug 10 20:56:57 2020 -0500
--------------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled - No sandbox or build area path
Crash Mode : continue (default)
Default Encoding : ISO-8859-1
Deployed : false
Graphics Driver : Unknown hardware
Java Version : Java 1.8.0_152-b16 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
MATLAB Architecture : maci64
MATLAB Entitlement ID : 4172684
MATLAB Root : /Applications/MATLAB_R2018b.app
MATLAB Version : 9.5.0.944444 (R2018b)
OpenGL : hardware
Operating System : Mac OS Version 10.15.3 (Build 19D76)
Process ID : 36252
Processor ID : x86 Family 6 Model 94 Stepping 3, GenuineIntel
Session Key : 77119fe6-d5b7-4d1f-87d1-4d6cd8847622
Window System : Quartz
Fault Count: 1
Abnormal termination
Register State (from fault):
RAX = 0000600006c14680 RBX = 0000700005ef3640
RCX = 000000010f775e3c RDX = 000000010f6b35b8
RSP = 0000600006a272c0 RBP = 0000600006c14680
RSI = 0000600006c14680 RDI = 0000000000000010
R8 = 0000600006c14380 R9 = 0000000000000000
R10 = 0000700005ef36f0 R11 = 000000019392c020
R12 = 0000700005ef3f18 R13 = 0000700005ef3930
R14 = 000000011b8145dd R15 = 0000700005ef3690
RIP = 00007fff6b9c9718 RFL = 0000700005ef3b58
CS = 0000600004295240 FS = 0000700005ef36c0 GS = 0000600006c14380
Stack Trace (from fault):
[ 0] 0x000000010f5e7dd1 bin/maci64/libmwfl.dylib+00007633 _ZN10foundation4core4diag15stacktrace_base7captureERKNS1_14thread_contextEm+00000049
[ 1] 0x000000010f5ed4b5 bin/maci64/libmwfl.dylib+00029877 _ZN10foundation4core4test17terminate_handledEv+00006181
[ 2] 0x000000010f5eb9f5 bin/maci64/libmwfl.dylib+00023029 _ZN10foundation4core4diag13terminate_logEPKcPK17__darwin_ucontext+00000149
[ 3] 0x000000011456d67b bin/maci64/libmwmcr.dylib+00632443 _Z19mnPrintErrorMessageRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+00012635
[ 4] 0x000000011456b207 bin/maci64/libmwmcr.dylib+00623111 _Z19mnPrintErrorMessageRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+00003303
[ 5] 0x0000000114568d64 bin/maci64/libmwmcr.dylib+00613732 mnFatalSignalHandler+00000148
[ 6] 0x00007fff6ea5c42d /usr/lib/system/libsystem_platform.dylib+00017453 _sigtramp+00000029
[ 7] 0x000000010f28a1b8 bin/maci64/libmwms.dylib+01155512 _ZTIN10foundation7msg_svc8eventmgr15DefaultEventMgrE+00000568
[ 8] 0x00000001155ea4bc bin/maci64/libmex.dylib+00242876 _ZNK18C_DispatchStrategy8dispatchEiPP11mxArray_tagiS2_+00000140
[ 9] 0x00000001155eaa6d bin/maci64/libmex.dylib+00244333 _ZNK24SCCompatDispatchStrategy8dispatchEiPP11mxArray_tagiS2_+00000061
[ 10] 0x00000001155ea274 bin/maci64/libmex.dylib+00242292 _ZN7Mfh_mex30dispatch_file_with_protectionsEiPP11mxArray_tagiS2_+00000484
[ 11] 0x00000001155d1dbf bin/maci64/libmex.dylib+00142783 _ZN7Mfh_mex13dispatch_fileEiPP11mxArray_tagiS2_+00000159
[ 12] 0x00000001146ae40a bin/maci64/libmwm_dispatcher.dylib+00500746 _ZN8Mfh_file16dispatch_fh_implEMS_FviPP11mxArray_tagiS2_EiS2_iS2_+00000746
[ 13] 0x00000001146ae593 bin/maci64/libmwm_dispatcher.dylib+00501139 _ZN8Mfh_file11dispatch_fhEiPP11mxArray_tagiS2_+00000035
[ 14] 0x0000000117de6fd7 bin/maci64/libmwm_lxe.dylib+09338839 _ZN9MathWorks3lxe17LxeDispatcherImpl12apply_handleEPNS0_29DispatcherFunctionHandleTokenEmPNS0_6xvalueEmPKS4_NS0_9ApplyTypeE+00001303
[ 15] 0x0000000117ee62eb bin/maci64/libmwm_lxe.dylib+10384107 _ZN9MathWorks3lxe12apply_handleEPvNS_2ts4TypeEPKvS1_S1_+00000507
[ 16] 0x0000000117e44cde bin/maci64/libmwm_lxe.dylib+09723102 _ZN9MathWorks3lxe38cpp_primitive_template_fn_with_contextIXadL_ZNS0_12apply_handleEPvNS_2ts4TypeEPKvS2_S2_EEEEbS2_S4_S6_S2_S2_+00000014
[ 17] 0x0000000117679740 bin/maci64/libmwm_lxe.dylib+01550144 _ZN9MathWorks3lxe13IrInterpreter17ApplyCppPrimitiveEPN2ir4termES4_RKNS_2ts4TypeES8_+00000448
[ 18] 0x0000000117678ad2 bin/maci64/libmwm_lxe.dylib+01546962 _ZN9MathWorks3lxe13IrInterpreter31process_application_of_constantEPN2ir4termE+00001202
[ 19] 0x000000011767732d bin/maci64/libmwm_lxe.dylib+01540909 _ZN9MathWorks3lxe13IrInterpreter13applyConstantEPN2ir4termE+00000077
[ 20] 0x0000000117672d13 bin/maci64/libmwm_lxe.dylib+01522963 _ZN9MathWorks3lxe12IRTreeWalker9applyTermEPN2ir4termE+00000099
[ 21] 0x0000000117672fb9 bin/maci64/libmwm_lxe.dylib+01523641 _ZN9MathWorks3lxe12IRTreeWalker11getNextIRPCENS0_9irpc_typeE+00000217
[ 22] 0x00000001176770c7 bin/maci64/libmwm_lxe.dylib+01540295 _ZN9MathWorks3lxe13IrInterpreter9tree_walkERKNS0_9irpc_typeES4_+00000215
[ 23] 0x0000000117676fab bin/maci64/libmwm_lxe.dylib+01540011 _ZN9MathWorks3lxe13IrInterpreter9InterpretEv+00000091
[ 24] 0x0000000117784faf bin/maci64/libmwm_lxe.dylib+02645935 _ZN9MathWorks3lxe15ExecutionDriver9ThreadRunEv+00000911
[ 25] 0x000000011778a107 bin/maci64/libmwm_lxe.dylib+02666759 _ZN9MathWorks3lxe12IrEngineImpl5ApplyERKN2ir4termEPvS6_+00000295
[ 26] 0x0000000117cc20b9 bin/maci64/libmwm_lxe.dylib+08138937 _ZN9MathWorks3lxe17IrEngineDecorator5ApplyERKN2ir4termEPvS6_+00000153
[ 27] 0x0000000117ddd111 bin/maci64/libmwm_lxe.dylib+09298193 _ZN9MathWorks3lxe27FileBasedMatlabCodeFunction25DispatchFunctionWithReuseEiPP11mxArray_tagiS4_+00001617
[ 28] 0x0000000117ddde6c bin/maci64/libmwm_lxe.dylib+09301612 _ZN9MathWorks3lxe27FileBasedMatlabCodeFunction12DispatchFileEiPP11mxArray_tagiS4_b+00000156
[ 29] 0x00000001146ae40a bin/maci64/libmwm_dispatcher.dylib+00500746 _ZN8Mfh_file16dispatch_fh_implEMS_FviPP11mxArray_tagiS2_EiS2_iS2_+00000746
[ 30] 0x00000001146ae5c3 bin/maci64/libmwm_dispatcher.dylib+00501187 _ZN8Mfh_file22dispatch_fh_with_reuseEiPP11mxArray_tagiS2_+00000035
[ 31] 0x0000000117f0f93c bin/maci64/libmwm_lxe.dylib+10553660 _ZNK9MathWorks3lxe21UnboundFunctionHandle6invokeEmPP11mxArray_tagmPKPKS2_+00000092
[ 32] 0x0000000117f0fa36 bin/maci64/libmwm_lxe.dylib+10553910 _ZNK9MathWorks3lxe21UnboundFunctionHandle6invokeEmPNS0_6xvalueEmPKS2_+00000166
[ 33] 0x0000000117f17200 bin/maci64/libmwm_lxe.dylib+10584576 _ZN9MathWorks3lxe20call_global_functionERNS0_14ILxeDispatcherEPKcPKNS0_29DispatcherFunctionHandleTokenEmPNS0_6xvalueEmPKS8_+00000272
[ 34] 0x0000000117de776c bin/maci64/libmwm_lxe.dylib+09340780 _ZN9MathWorks3lxe17LxeDispatcherImpl14apply_dispatchEPKcPKNS0_29DispatcherFunctionHandleTokenEmPNS0_6xvalueEmPKS7_+00000188
[ 35] 0x0000000117ee4728 bin/maci64/libmwm_lxe.dylib+10377000 _ZN9MathWorks3lxe14apply_dispatchEPvNS_2ts4TypeEPKvS1_S1_+00000488
[ 36] 0x0000000117e709ae bin/maci64/libmwm_lxe.dylib+09902510 _ZN9MathWorks3lxe38cpp_primitive_template_fn_with_contextIXadL_ZNS0_14apply_dispatchEPvNS_2ts4TypeEPKvS2_S2_EEEEbS2_S4_S6_S2_S2_+00000014
[ 37] 0x0000000117679740 bin/maci64/libmwm_lxe.dylib+01550144 _ZN9MathWorks3lxe13IrInterpreter17ApplyCppPrimitiveEPN2ir4termES4_RKNS_2ts4TypeES8_+00000448
[ 38] 0x0000000117678ad2 bin/maci64/libmwm_lxe.dylib+01546962 _ZN9MathWorks3lxe13IrInterpreter31process_application_of_constantEPN2ir4termE+00001202
[ 39] 0x000000011767732d bin/maci64/libmwm_lxe.dylib+01540909 _ZN9MathWorks3lxe13IrInterpreter13applyConstantEPN2ir4termE+00000077
[ 40] 0x0000000117672d13 bin/maci64/libmwm_lxe.dylib+01522963 _ZN9MathWorks3lxe12IRTreeWalker9applyTermEPN2ir4termE+00000099
[ 41] 0x0000000117672fb9 bin/maci64/libmwm_lxe.dylib+01523641 _ZN9MathWorks3lxe12IRTreeWalker11getNextIRPCENS0_9irpc_typeE+00000217
[ 42] 0x00000001176770c7 bin/maci64/libmwm_lxe.dylib+01540295 _ZN9MathWorks3lxe13IrInterpreter9tree_walkERKNS0_9irpc_typeES4_+00000215
[ 43] 0x0000000117676fab bin/maci64/libmwm_lxe.dylib+01540011 _ZN9MathWorks3lxe13IrInterpreter9InterpretEv+00000091
[ 44] 0x0000000117784faf bin/maci64/libmwm_lxe.dylib+02645935 _ZN9MathWorks3lxe15ExecutionDriver9ThreadRunEv+00000911
[ 45] 0x000000011778a107 bin/maci64/libmwm_lxe.dylib+02666759 _ZN9MathWorks3lxe12IrEngineImpl5ApplyERKN2ir4termEPvS6_+00000295
[ 46] 0x0000000117cc20b9 bin/maci64/libmwm_lxe.dylib+08138937 _ZN9MathWorks3lxe17IrEngineDecorator5ApplyERKN2ir4termEPvS6_+00000153
[ 47] 0x0000000117ddd111 bin/maci64/libmwm_lxe.dylib+09298193 _ZN9MathWorks3lxe27FileBasedMatlabCodeFunction25DispatchFunctionWithReuseEiPP11mxArray_tagiS4_+00001617
[ 48] 0x0000000117ddde6c bin/maci64/libmwm_lxe.dylib+09301612 _ZN9MathWorks3lxe27FileBasedMatlabCodeFunction12DispatchFileEiPP11mxArray_tagiS4_b+00000156
[ 49] 0x00000001146ae40a bin/maci64/libmwm_dispatcher.dylib+00500746 _ZN8Mfh_file16dispatch_fh_implEMS_FviPP11mxArray_tagiS2_EiS2_iS2_+00000746
[ 50] 0x00000001146ae5c3 bin/maci64/libmwm_dispatcher.dylib+00501187 _ZN8Mfh_file22dispatch_fh_with_reuseEiPP11mxArray_tagiS2_+00000035
[ 51] 0x0000000117f0f93c bin/maci64/libmwm_lxe.dylib+10553660 _ZNK9MathWorks3lxe21UnboundFunctionHandle6invokeEmPP11mxArray_tagmPKPKS2_+00000092
[ 52] 0x0000000117f0fa36 bin/maci64/libmwm_lxe.dylib+10553910 _ZNK9MathWorks3lxe21UnboundFunctionHandle6invokeEmPNS0_6xvalueEmPKS2_+00000166
[ 53] 0x0000000117f17200 bin/maci64/libmwm_lxe.dylib+10584576 _ZN9MathWorks3lxe20call_global_functionERNS0_14ILxeDispatcherEPKcPKNS0_29DispatcherFunctionHandleTokenEmPNS0_6xvalueEmPKS8_+00000272
[ 54] 0x0000000117de776c bin/maci64/libmwm_lxe.dylib+09340780 _ZN9MathWorks3lxe17LxeDispatcherImpl14apply_dispatchEPKcPKNS0_29DispatcherFunctionHandleTokenEmPNS0_6xvalueEmPKS7_+00000188
[ 55] 0x0000000117ee4728 bin/maci64/libmwm_lxe.dylib+10377000 _ZN9MathWorks3lxe14apply_dispatchEPvNS_2ts4TypeEPKvS1_S1_+00000488
[ 56] 0x0000000117e709ae bin/maci64/libmwm_lxe.dylib+09902510 _ZN9MathWorks3lxe38cpp_primitive_template_fn_with_contextIXadL_ZNS0_14apply_dispatchEPvNS_2ts4TypeEPKvS2_S2_EEEEbS2_S4_S6_S2_S2_+00000014
[ 57] 0x0000000117679740 bin/maci64/libmwm_lxe.dylib+01550144 _ZN9MathWorks3lxe13IrInterpreter17ApplyCppPrimitiveEPN2ir4termES4_RKNS_2ts4TypeES8_+00000448
[ 58] 0x0000000117678ad2 bin/maci64/libmwm_lxe.dylib+01546962 _ZN9MathWorks3lxe13IrInterpreter31process_application_of_constantEPN2ir4termE+00001202
[ 59] 0x000000011767732d bin/maci64/libmwm_lxe.dylib+01540909 _ZN9MathWorks3lxe13IrInterpreter13applyConstantEPN2ir4termE+00000077
[ 60] 0x0000000117672d13 bin/maci64/libmwm_lxe.dylib+01522963 _ZN9MathWorks3lxe12IRTreeWalker9applyTermEPN2ir4termE+00000099
[ 61] 0x0000000117672fb9 bin/maci64/libmwm_lxe.dylib+01523641 _ZN9MathWorks3lxe12IRTreeWalker11getNextIRPCENS0_9irpc_typeE+00000217
[ 62] 0x00000001176770c7 bin/maci64/libmwm_lxe.dylib+01540295 _ZN9MathWorks3lxe13IrInterpreter9tree_walkERKNS0_9irpc_typeES4_+00000215
[ 63] 0x0000000117676fab bin/maci64/libmwm_lxe.dylib+01540011 _ZN9MathWorks3lxe13IrInterpreter9InterpretEv+00000091
[ 64] 0x0000000117784faf bin/maci64/libmwm_lxe.dylib+02645935 _ZN9MathWorks3lxe15ExecutionDriver9ThreadRunEv+00000911
[ 65] 0x000000011778a107 bin/maci64/libmwm_lxe.dylib+02666759 _ZN9MathWorks3lxe12IrEngineImpl5ApplyERKN2ir4termEPvS6_+00000295
[ 66] 0x0000000117cc20b9 bin/maci64/libmwm_lxe.dylib+08138937 _ZN9MathWorks3lxe17IrEngineDecorator5ApplyERKN2ir4termEPvS6_+00000153
[ 67] 0x0000000117ddd111 bin/maci64/libmwm_lxe.dylib+09298193 _ZN9MathWorks3lxe27FileBasedMatlabCodeFunction25DispatchFunctionWithReuseEiPP11mxArray_tagiS4_+00001617
[ 68] 0x0000000117ddde6c bin/maci64/libmwm_lxe.dylib+09301612 _ZN9MathWorks3lxe27FileBasedMatlabCodeFunction12DispatchFileEiPP11mxArray_tagiS4_b+00000156
[ 69] 0x00000001146ae40a bin/maci64/libmwm_dispatcher.dylib+00500746 _ZN8Mfh_file16dispatch_fh_implEMS_FviPP11mxArray_tagiS2_EiS2_iS2_+00000746
[ 70] 0x00000001146ae5c3 bin/maci64/libmwm_dispatcher.dylib+00501187 _ZN8Mfh_file22dispatch_fh_with_reuseEiPP11mxArray_tagiS2_+00000035
[ 71] 0x0000000115c112bf bin/maci64/libmwlxeindexing.dylib+00324287 _ZNK9MathWorks3lxe27OverloadedObjectRmultiplace9GetFirstNEm+00000159
[ 72] 0x0000000115c11444 bin/maci64/libmwlxeindexing.dylib+00324676 _ZNK9MathWorks3lxe27OverloadedObjectRmultiplace21GetCommaSeparatedListENS0_12IRmultiplace25CommaSeperatedListContextE+00000052
[ 73] 0x0000000115c04013 bin/maci64/libmwlxeindexing.dylib+00270355 _ZNK9MathWorks3lxe33MxArrayOwningRmultiplaceDecorator21GetCommaSeparatedListENS0_12IRmultiplace25CommaSeperatedListContextE+00000019
[ 74] 0x0000000115c34fb7 bin/maci64/libmwlxeindexing.dylib+00470967 _ZNK9MathWorks3lxe17XvalueRmultiplace21GetCommaSeparatedListENS0_12IRmultiplace25CommaSeperatedListContextE+00000071
[ 75] 0x0000000115bdad7f bin/maci64/libmwlxeindexing.dylib+00101759 _ZN9MathWorks3lxe9At0CommonIXadL_ZNS0_34DisplayAllButLastMultivalueResultsERKNS0_10MultiValueEPvEEEENS0_6xvalueERKNS0_12IRmultiplaceES5_+00000031
[ 76] 0x0000000115c1ef09 bin/maci64/libmwlxeindexing.dylib+00380681 _ZN9MathWorks3lxe14at_rdot0_printEPvNS_2ts4TypeEPKvS1_+00000137
[ 77] 0x0000000117e6fb3e bin/maci64/libmwm_lxe.dylib+09898814 _ZN9MathWorks3lxe36cpp_parametric_primitive_template_fnIXadL_ZNS0_14at_rdot0_printEPvNS_2ts4TypeEPKvS2_EEEEbS2_S4_S6_S2_+00000014
[ 78] 0x000000011767971d bin/maci64/libmwm_lxe.dylib+01550109 _ZN9MathWorks3lxe13IrInterpreter17ApplyCppPrimitiveEPN2ir4termES4_RKNS_2ts4TypeES8_+00000413
[ 79] 0x0000000117678ad2 bin/maci64/libmwm_lxe.dylib+01546962 _ZN9MathWorks3lxe13IrInterpreter31process_application_of_constantEPN2ir4termE+00001202
[ 80] 0x000000011767732d bin/maci64/libmwm_lxe.dylib+01540909 _ZN9MathWorks3lxe13IrInterpreter13applyConstantEPN2ir4termE+00000077
[ 81] 0x0000000117672d13 bin/maci64/libmwm_lxe.dylib+01522963 _ZN9MathWorks3lxe12IRTreeWalker9applyTermEPN2ir4termE+00000099
[ 82] 0x0000000117672fb9 bin/maci64/libmwm_lxe.dylib+01523641 _ZN9MathWorks3lxe12IRTreeWalker11getNextIRPCENS0_9irpc_typeE+00000217
[ 83] 0x00000001176770c7 bin/maci64/libmwm_lxe.dylib+01540295 _ZN9MathWorks3lxe13IrInterpreter9tree_walkERKNS0_9irpc_typeES4_+00000215
[ 84] 0x0000000117676fab bin/maci64/libmwm_lxe.dylib+01540011 _ZN9MathWorks3lxe13IrInterpreter9InterpretEv+00000091
[ 85] 0x0000000117784faf bin/maci64/libmwm_lxe.dylib+02645935 _ZN9MathWorks3lxe15ExecutionDriver9ThreadRunEv+00000911
[ 86] 0x000000011778a107 bin/maci64/libmwm_lxe.dylib+02666759 _ZN9MathWorks3lxe12IrEngineImpl5ApplyERKN2ir4termEPvS6_+00000295
[ 87] 0x0000000117cc20b9 bin/maci64/libmwm_lxe.dylib+08138937 _ZN9MathWorks3lxe17IrEngineDecorator5ApplyERKN2ir4termEPvS6_+00000153
[ 88] 0x0000000117c71609 bin/maci64/libmwm_lxe.dylib+07808521 _ZN9MathWorks3lxe9Evaluator15ApplyStatementsERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKN2ir4termERNS0_18IEvaluationContextE+00000425
[ 89] 0x0000000117c750ee bin/maci64/libmwm_lxe.dylib+07823598 _ZN9MathWorks3lxe9Evaluator17EvalStatementImplERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERNS0_18IEvaluationContextE+00000206
[ 90] 0x0000000117c751ba bin/maci64/libmwm_lxe.dylib+07823802 _ZN9MathWorks3lxe9Evaluator13EvalStatementERKNSt3__112basic_stringIDsNS2_11char_traitsIDsEENS2_9allocatorIDsEEEERNS0_18IEvaluationContextE+00000106
[ 91] 0x0000000117cfdb87 bin/maci64/libmwm_lxe.dylib+08383367 _ZN9MathWorks3lxe9LxeBridge7EvalCmdERKNSt3__112basic_stringIDsNS2_11char_traitsIDsEENS2_9allocatorIDsEEEEb+00000327
[ 92] 0x0000000117cfda77 bin/maci64/libmwm_lxe.dylib+08383095 _ZN9MathWorks3lxe9LxeBridge7EvalCmdERKNSt3__112basic_stringIDsNS2_11char_traitsIDsEENS2_9allocatorIDsEEEEb+00000055
[ 93] 0x00000001156edd8d bin/maci64/libmwbridge.dylib+00073101 _Z8mnParserv+00000653
[ 94] 0x00000001145028c9 bin/maci64/libmwmcr.dylib+00194761 _ZN3mcr7runtime26InterpreterThreadSingleton4Impl16break_event_loopERKN7mwboost10shared_ptrIS2_EE+00003369
[ 95] 0x0000000114502bf9 bin/maci64/libmwmcr.dylib+00195577 _ZN3mcr7runtime26InterpreterThreadSingleton4Impl16break_event_loopERKN7mwboost10shared_ptrIS2_EE+00004185
[ 96] 0x00000001144df1f5 bin/maci64/libmwmcr.dylib+00049653 _ZN14cmddistributor15PackagedTaskIIP13getTypeStringIvEENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEv+00000917
[ 97] 0x00000001144df137 bin/maci64/libmwmcr.dylib+00049463 _ZN14cmddistributor15PackagedTaskIIP13getTypeStringIvEENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEv+00000727
[ 98] 0x00000001144df0e2 bin/maci64/libmwmcr.dylib+00049378 _ZN14cmddistributor15PackagedTaskIIP13getTypeStringIvEENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEv+00000642
[ 99] 0x00000001143df74e bin/maci64/libmwiqm.dylib+00366414 _ZN7mwboost6detail8function21function_obj_invoker0INSt3__18functionIFNS_3anyEvEEES5_E6invokeERNS1_15function_bufferE+00000030
[100] 0x00000001143df16b bin/maci64/libmwiqm.dylib+00364907 _ZN3iqm18PackagedTaskPlugin7executeEP15inWorkSpace_tag+00000251
[101] 0x00000001143c0b5f bin/maci64/libmwiqm.dylib+00240479 _ZNK3iqm17DefaultPacketInfo7executeEP15inWorkSpace_tag+00000799
[102] 0x00000001143a499b bin/maci64/libmwiqm.dylib+00125339 _ZN3iqm10DefaultIqm13dequeueHelperEN7mwboost8optionalImEERKNSt3__112basic_stringIDsNS4_11char_traitsIDsEENS4_9allocatorIDsEEEEN6mlutil14cmddistributor13WhenToDequeue13WhenToDequeueERKNS4_8functionIFbRKNS4_5tupleIJSG_NS1_10shared_ptrINS_22IntermediatePacketInfoEEESA_EEEEEE+00001195
[103] 0x0000000114398dca bin/maci64/libmwiqm.dylib+00077258 _ZN3iqm10DefaultIqm7dequeueEN6mlutil14cmddistributor13WhenToDequeue13WhenToDequeueEN7mwboost8optionalImEE+00000362
[104] 0x00000001143aa766 bin/maci64/libmwiqm.dylib+00149350 _ZN3tbb10interface519concurrent_hash_mapIN6mlutil10contextmgr5McrIDEN7mwboost10shared_ptrIN3iqm17DebugEventHandlerEEEN10foundation7msg_svc10threadutil4HashIS4_EENS_13tbb_allocatorINSt3__14pairIS4_S9_EEEEE28allocate_node_copy_constructERNSF_INSK_4nodeEEERKS4_PKS9_+00006198
[105] 0x000000010d1d98e5 bin/maci64/libmwservices.dylib+01239269 _Z40svWS_ProcessPendingEventsWithLimitedRateb+00003301
[106] 0x000000010d1d80f6 bin/maci64/libmwservices.dylib+01233142 _Z25svWS_ProcessPendingEventsiib+00001094
[107] 0x000000010d1d7d5f bin/maci64/libmwservices.dylib+01232223 _Z25svWS_ProcessPendingEventsiib+00000175
[108] 0x0000000114501284 bin/maci64/libmwmcr.dylib+00189060 _ZN3mcr7runtime26InterpreterThreadSingleton4Impl14process_eventsERKN7mwboost10shared_ptrIS2_EE+00000356
[109] 0x0000000114501957 bin/maci64/libmwmcr.dylib+00190807 _ZN3mcr7runtime26InterpreterThreadSingleton4Impl3runERKN7mwboost10shared_ptrIS2_EEPNS2_12init_contextE+00000279
[110] 0x00000001144fcc1a bin/maci64/libmwmcr.dylib+00171034 _Z26run_init_and_handle_eventsPv+00000266
[111] 0x00007fff6ea67e65 /usr/lib/system/libsystem_pthread.dylib+00024165 _pthread_start+00000148
[112] 0x00007fff6ea6383b /usr/lib/system/libsystem_pthread.dylib+00006203 thread_start+00000015
This error was detected while a MEX-file was running. If the MEX-file
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEX-files.
** This crash report has been saved to disk as /Users/Hannah/matlab_crash_dump.36252-1 **
Caught MathWorks::System::FatalException
[Please exit and restart MATLAB]>>
I am not sure what the problem is, but I am guessing it is somehow related to this version of matlab and its compatability with old C files. I have run this succesfully on previous versions of matlab, though I could not tell you off the top of my head which ones. Any help would be appreciated.hswhttps://nl.mathworks.com/matlabcentral/profile/authors/4043137tag:nl.mathworks.com,2005:Question/5778852020-08-10T23:09:24Z2020-08-11T03:00:59ZPlot a filled black circle on a certain backgroundI have a 344*344 grey level image with noise only. Now I want to plot a filled black circle in the middle of that gray image as background.
How can I achieve that? And I hope I can also adjust the size (scale) of the filled black circle in the middle of the image.
Thanks so much!!Chenhttps://nl.mathworks.com/matlabcentral/profile/authors/5673852tag:nl.mathworks.com,2005:Question/5779392020-08-11T02:58:49Z2020-08-11T02:58:49ZError Adding Images to Camera Calibrator AppI'm trying to calibrate a camera using the Camera Calibnrator App but every time I try adding images, it fails with the following error:
"Dot indexing is not supported for variables of this type."
I tried with different Matlab versions (2018a, 2020a) and with different cameras but it never works.
I also tried to take the images using directly the Camera Calibrator App but I get the same error.
Does anyone know how to solve it?
Thanks!Francesco De Pacehttps://nl.mathworks.com/matlabcentral/profile/authors/5933096tag:nl.mathworks.com,2005:Question/2332302015-08-11T12:25:40Z2020-08-11T02:51:40Zchange ticklabels using m_mapHi!
I have problems to change ticklabels using m_map.
My labels for longitude and latitude are overlapping, so I tried to set specific labels for the longitude. The longitude range for my map is -180 to 180.
I have used the following command.
m_grid('xaxis','middle','xtick',5,'xticklabel',{'120W','60W','0','60E','120E'},'ytick',5);
The result with this command is always, that I got longitude labels from -180 to 180. I tried many other things which are recommended just for Matlab, but it is still not working.
Does someone know how to change the labels using m_map?
Lena Freyhttps://nl.mathworks.com/matlabcentral/profile/authors/5825235tag:nl.mathworks.com,2005:Question/5779302020-08-11T02:46:04Z2020-08-11T02:46:04ZHow to correct the Simscape Multibody CAD connections I imported my CAD model into simscape multibody, but a part of my assembly seems to "fly away" due to gravity. My CAD model seems fine. I attach pictures to make it clearer. I think it has to do with the fames. Does anyone have any idea? Thank you
Eleni.Thttps://nl.mathworks.com/matlabcentral/profile/authors/16876768tag:nl.mathworks.com,2005:Question/5761062020-08-06T13:49:40Z2020-08-11T02:45:33ZHow to solve the discontinuity of MPC controller output？In simulink, I used the MPC toolbox to obtain the control value calculated by MPC with a sampling period of 0.05s.
In the following calculations, I need to derive the control variable. However, 0.05s is much smaller than the simulation step size, which leads to an infinite value for the derivative.
I tried to use low-pass filtering, but it still can't solve the problem well.
The MPC algorithm should calculate the control variables in the control horizon together, and then output them one by one. Is it possible to perform interpolation processing before the output of the MPC controller? Or is there any better way to solve this difficulty?Jingchao Lihttps://nl.mathworks.com/matlabcentral/profile/authors/15471591