https://se.mathworks.com/matlabcentral/answers/questionsMATLAB Answers — New Questions2020-10-20T20:46:12Ztag:se.mathworks.com,2005:Question/6193032020-10-19T20:34:42Z2020-10-20T20:46:12ZRepeating a sequence of code multiple times in a for loop with random intervals in betweenI want to repeat the following code 150 times with 500-800 milliseconds in between (i.e. I want the iterations to be spaced apart randomly, with each spacing being between 500 and 800).
rec=@(x) (x)>=0.75
j = (0 : 0.01 : 29);
k = sin(j);
f = rec(k);
[a,b]=find(f~=0);
N=length(b);
s=0.15;
f=double(f);
f(b)=1+s*rand(1,N);
plot(j,f);
axis([0 29 0 2])Emma Platerhttps://se.mathworks.com/matlabcentral/profile/authors/14638994tag:se.mathworks.com,2005:Question/6203832020-10-20T18:08:13Z2020-10-20T20:45:27ZSubscript in figure WHAT AM I DOING WRONG? Hi, for some reason I can't get subscript on my axes titles to work properly, below I've tried two different ways to produce suscript that work on my scatter plots, but are not functioning here. When run, the axes titles are exactly as written with all the symbols. Can someone please tell me what I've done wrong? Running version version R0219b. Thank you for your time.
mdl = fitlm(x,y)
coefCI(mdl)
plot(mdl,'Marker','.','Color','b')
ylabel('Comparison 1 NO_2 ppb_v')
xlabel('Comparison 2 [NO_{2}] ppb_{v}')Danielle Blumhttps://se.mathworks.com/matlabcentral/profile/authors/14180044tag:se.mathworks.com,2005:Question/6204882020-10-20T20:19:14Z2020-10-20T20:44:33ZHow to find a point within a curve?Hello to all,
How can I calculate a point (the red point) on the same curve but 500 units less than the point indicated in blue? (see graph). The pairs (x,y) of the curve are contained in a cell within an array. I tried with the code that I copy here, but I have problems with the “find" command, because I must be changing the absolute difference manually and since I have to automate the process, this is not an option for me. Thanks for your help!
w=1936 %This is an specific day and the graph shown here is the graph from this day
k = find(abs(Array_demand{w}.Volume- x_blue_point{w}+500) < 70,1)
%Find its correspondance within the curve for X (Volume)
x_red_point=Array_demand{w}.Volume(k);
%Find its correspondance within the curve for Y(Price)
y_red_point=Array_demand{w}.Price(k);
Angelavtchttps://se.mathworks.com/matlabcentral/profile/authors/17242946tag:se.mathworks.com,2005:Question/6205032020-10-20T20:42:34Z2020-10-20T20:42:34ZIndex in position 2 exceeds array bounds (must not exceed 8)I keep getting the error "Index in position 2 exceeds array bounds (must not exceed 8) with the following code. I am trying to determine whether a matrix is strictly diagonally dominant or not. The error appears on the line with sumrow=sumrow+abs(A(i,j));
This is the code.
A = [28 -6 4 1 -2 -5 8 0; -4 28 -1 4 0 4 4 6; 1 -6 26 -5 1 -1 -6 0; 1 -6 26 -5 1 -1 -6 0; -5 -6 1 21 0 -3 2 2; 4 1 3 -3 17 0 -3 3; 4 -2 3 0 2 14 0 1; 1 2 4 3 -2 1 17 4; 1 3 1 3 0 -1 3 15];
rowcol=size(A);
n=rowcol(1);
count=0;
for i=1:1:n
sumrow=0;
for j=1:1:n
if i~=j
sumrow=sumrow+abs(A(i,j));
end
end
if abs(A(i,i))>sumrow
count=count+1;
end
end
if count==n
disp('Matrix is strictly diagonal dominant')
else
disp('Matrix is NOT strictly diagonal dominant')
end
Any help with corrections will be greatly appreciated. Surya Ramanthanhttps://se.mathworks.com/matlabcentral/profile/authors/16096529tag:se.mathworks.com,2005:Question/6204982020-10-20T20:38:58Z2020-10-20T20:38:58ZWhy do I only have an output of zeros for the 1 X 800So I have this code that I developed for the function Kr_eff to get the output of five different coefficient values, but I only get zeros:
Here is my function:
function [Kr_eff] = refra_eff(Hs,fp,smax,alpha_po,d)
%--------------------------------------------------------------------------
% function Kr_eff = refra_eff(Hs,fp,smax,alpha_po,d)
% To calculate Kr Input
% Hs = significant water wave height
% fp = peak frequency array in Hz.
% smax = swell with short decay distance: (with relatively large wave steepness)
% alpha_po = angle array in degrees
% d = water depth
% Output
% Kr = refraction coefficient
%--------------------------------------------------------------------------
%alpha_po = alpha_po * pi / 180; % from degree to radian
Tp = 1/fp % peak period
Ts = Tp/1.05 % significant wave period
g = 9.81 % gravity
Lo = (g*(Ts^2))/(2*pi) % initial deep water wave length
% to obtain thetadeg use directional spectrum function
[S,thetadeg,f] = directional_wave_spec(Hs,fp,smax)
theta = thetadeg*pi/180; % degrees to radians
B = zeros(1,800)
Alpha_po = [alpha_po theta]
C = zeros(1,1)
Theta = [theta C]
% loop for theta 1 to 180 degrees which would be pi in radians
alpha_o = Alpha_po + (Theta./2)
[Kr,alpha] = refra(d,Ts,alpha_o)
L = ldis(d,Ts) % linear dispersion computes wavelength
Ks = shoal(d,Ts) % shoaling coefficient
mso = sum(S.*(Ks^2))
Kr_eff = ((1./mso).*sum(S.*(Ks.^2).*(Kr.^2)))
%alpha = alpha * 180 / pi; % from radian to degree
And here is the script when I test out my function:
% Nella HW 3
% Testing Kr_eff Script
clc, clear
Hs = 1; % significant wave height meters
fp = 0.1; % peak frequency
g = 9.81; % gravity
smax = 25; % swell with short decay distance: (with relatively large wave steepness)
d = 20 % from 0 to an infinite depth in meters
Tp = 1/fp % peak period
Ts = Tp/1.05 % significant wave period
g = 9.81 % gravity
Lo = (g*(Ts^2))/(2*pi) % initial deep water wave length
alpha_po1 = 0
Kr_eff1 = refra_eff(Hs,fp,smax,alpha_po1,d)
alpha_po2 = 20
Kr_eff2 = refra_eff(Hs,fp,smax,alpha_po2,d)
alpha_po3 = 30
Kr_eff3 = refra_eff(Hs,fp,smax,alpha_po3,d)
alpha_po4 = 40
Kr_eff4 = refra_eff(Hs,fp,smax,alpha_po4,d)
I then want to plot these values of Kr_eff in a plot, but they only are zeros, please help.Agnella Dougalhttps://se.mathworks.com/matlabcentral/profile/authors/9802593tag:se.mathworks.com,2005:Question/6200532020-10-20T12:58:24Z2020-10-20T20:34:39ZHow to Integrate two MATLAB Simulink ModelsI need your help for connecting/ merging the two models on MATLAB Simulink; one is with partial shading PV array model and the other is the detailed model 100 KW grid connected PV array and both models are built in MATLAB.
Does anyone have an idea how to connect those two models into one and make it works? I will be gratefull for any help.
Thank you in advance.Sahar Usefhttps://se.mathworks.com/matlabcentral/profile/authors/19552711tag:se.mathworks.com,2005:Question/991502009-10-11T21:34:00Z2020-10-20T20:32:46ZIs there an example of using MATLAB to create PowerPoint slides?Is there a way, from MATLAB, to write images and content directly into PowerPoint slides? Do you have any examples of how to do this?
MathWorks Support Teamhttps://se.mathworks.com/matlabcentral/profile/authors/4622813tag:se.mathworks.com,2005:Question/6200882020-10-20T13:17:13Z2020-10-20T20:31:56Zfsolve function give poor results for multiple equationsI want to get 7 parameters used in three different equations (let's say equation CP, S, and H), however, I am only happy for the fitted parameters for H equation. The fitted results for CP and S is really poor. How to improve it? What I wish is that the fitted R square is minimun for the three equations. The code is listed below. Thanks in advance.
function y = nonlinmodel(x,Temp,CP,S,H)
y = [CP - 8.314*(x(1)+x(2)*Temp+x(3)*Temp.^2+x(4)*Temp.^3+x(5)*Temp.^4);
S - 8.314*(x(1)*log(Temp)+x(2)*Temp+x(3)/2*Temp.^2+x(4)/3*Temp.^3+x(5)/4*Temp.^4+x(7));
H - 8.314*(x(1)*Temp+x(2)*Temp.^2/2+x(3)/3*Temp.^3+x(4)/4*Temp.^4+x(5)/5*Temp.^5+x(6))];
end
Temp=[1200 1300 1500 1600 1700 1800 2000 2200 2500];
S=[520.042428000000 567.730080000000 582.090804000000 595.781640000000 608.844456000000 633.337236000000 655.862220000000 686.593332000000 731.182752000000];
CP=[206.367372000000 220.686228000000 224.245008000000 227.343240000000 230.064660000000 234.586404000000 238.145184000000 242.164512000000 246.644388000000];
H=[-121082.256000000 -56898.6120000000 -34624.8360000000 -12057.9840000000 10801.9440000000 57275.4240000000 104586.264000000 176641.092000000 298937.520000000];
f = @(x)nonlinmodel(x,Temp,CP,S,H);
optimal_x = fsolve(f,[1;0.2;0.03;0.004;0.00005;6;72]);
Peng Liuhttps://se.mathworks.com/matlabcentral/profile/authors/20048433tag:se.mathworks.com,2005:Question/6203432020-10-20T17:17:50Z2020-10-20T20:29:27ZHow to calculate the rotating azimuth angle?How to calculate the rotating azimuth angle for one full day, 24 hours? Rotation starts at angle a = 8 when the time is 00:00. The rotation should not exceed 360 degrees in 24 hours.
Thank you,Feyza Boyunhttps://se.mathworks.com/matlabcentral/profile/authors/20052080tag:se.mathworks.com,2005:Question/6177882020-10-18T13:37:00Z2020-10-20T20:28:27ZCreate an animation to show that the ship is safe.An enemy submarine determined to sink your ship is sitting, torpedoes armed, exactly halfway between you and your home port. The submarine submerges to some fixed depth, and your ship now has no further information about its position. The enemy sub has to be directly underneath your ship to sink it — but the sub can track your moves with precision and respond efficiently. If your ship is fast enough, though, you will be able to set a wide course around the sub and reach port safely.
How much faster than the sub does your ship have to be to guarantee you can avoid the sub and get home?
I am trying to create ananimation for this . I am struggling. This is what I tried.
Couldyou please help me out.
theta = linspace(-pi,pi);
xc = cos(theta);
yc = -sin(theta);
plot(xc,yc);
axis equal
xt = [1 0.5 -1];
yt = [0 -0.4 0];
hold on
t = area(xt,yt); % initial flat triangle
hold off
for j = 1:length(theta)-10
xt(2) = xc(j); % determine new vertex value
yt(2) = yc(j);
t.XData = xt; % update data properties
t.YData = yt;
drawnow limitrate % display updates
Ntombikayise Bhenguhttps://se.mathworks.com/matlabcentral/profile/authors/19335912tag:se.mathworks.com,2005:Question/6204932020-10-20T20:26:15Z2020-10-20T20:26:15Zsetting up a nested data structureI have a large data set containing a 300x1 matrix of various male heights and another 300x1 matrix of female heights. I sorted these heights manually using a selection sort algorithm and also using matlab's sort() command. I then timed the manual and matlab excecutions using the tic/toc commands. Basically I need to create a nested strucure that includes the sorted male and female heights as well as the manual and matlab run times for each gender. the included image details what needs to be stored into what
How do I put the manual and matlab data into the appropriate gender (female or male)? here is the code I used (its very wrong)
(female=300x1 height matrix
male=height matrix)
SortedHeights=struct('Female Heights',female,struct('Manual',manual_time,'Matlab',matlab_female),'Male Heights',male,struct('Manual',manual_time,'Matlab',matlab_male))
i apologize if any of my wording is confusing lolscobug411https://se.mathworks.com/matlabcentral/profile/authors/19295576tag:se.mathworks.com,2005:Question/6157932020-10-16T07:02:44Z2020-10-20T20:20:02ZFinding maximum of a function using optimization toolboxfunction [p_uth,Eload] = threshold(ann_load)
for i = 1:size(ann_load,2)
p_uth(i) = 1.6; % upper threshold - temporarily assigned for now
pES_val = ann_load(:,i)-p_uth(i); % calculating load values above the upper thresold value
load_val = ann_load(:,i); % assigning load values of a day to load_val variable
x_p_uth = findX((1:size(ann_load,1))',load_val,p_uth(i)); % finding x-coordinates where upper threshold touches the load curve
y_temp = zeros(size(x_p_uth,1),1)*p_uth(i); % array of upper thresold values - to facilitate calculations
pES = pES_val(pES_val>0); % P_ES values
index_pES = find(pES_val>0); % index of P_ES values greater than 0
y_val = [y_temp;pES]; % uniting arrays of y values
x_val = [x_p_uth;index_pES]; % uniting arrays of x values
[x_sorted,sort_index] = sort(x_val); % sorting the x values array
y_sorted = y_val(sort_index); % sorting the y values array
Eload(i) = trapz(x_sorted,y_sorted)*5/12; % finding area under the curve of pES values
end
end
In the above I need to find the maximum of 'Eload', which is the objective function. As evident from the code, I am considering p_uth and pES as the variables. Hence Eload = f(p_uth,pES). I need to maximize Eload which can be done by varying p_uth, which needs to be varied between its upper and lower bounds. Eload and p_uth will be 1x366 array. The input to the function, ann_load, is a 288x366 array.
pES is calculated automatically based on the relation mentioned in the above code
pES_val = ann_load(:,i)-p_uth(i);
pES = pES_val(pES_val>0);
It can be noted that array size of pES varies in every iteration as the no. of positive values change in every iteration, based on the above equation.
Given the current conditions, I don't know how to use the optimization toolbox to find the maximum. I think I can solve it using nested loops in a scripted file instead of a function but I want the best possible solution using optimization toolbox. Does anybody have an insight as to how to solve it. Any help is appreciated.Satya Venkata Siddhardha Manchalahttps://se.mathworks.com/matlabcentral/profile/authors/13365228tag:se.mathworks.com,2005:Question/6188832020-10-19T14:15:12Z2020-10-20T20:17:56ZHow to clear the compile to stand-alone history?Hi All
I am trying to compile my file to stand alone via app designer. but since I am doing it many times, I am noticing that the changes I am making and every time opening, puts the project name an old project name from a mlapp file that I am not using anymore. any suggestion how to resolve this problem ?farzadhttps://se.mathworks.com/matlabcentral/profile/authors/2231846tag:se.mathworks.com,2005:Question/6204632020-10-20T19:43:34Z2020-10-20T20:15:47ZHow do I use an unusual base in a semilogx plot?Is it possible to plot data against an x-axis with a log base 1.85 axis? The default is log base 10, and I've found a way to do log base 2, but not odd values.
Thanks!Ryan Consellhttps://se.mathworks.com/matlabcentral/profile/authors/17941415tag:se.mathworks.com,2005:Question/4381842019-01-03T23:27:42Z2020-10-20T20:13:18ZHow to solve a matlab function on simulink? (output cannot be an mxArray in this context)I'm using a matlab function on simulink like this:
function [u1,u2] = fcn(To,desf,clock)
t = clock;
F=1/To;
coder.extrinsic('square');
u1=square(2*pi*F*t);
u2=square(2*pi*F*(t-desf));
end
But appears this mistake:
Function output 'u1' cannot be an mxArray in this contextoutput 'u1' cannot be an mxArray in this context. Consider preinitializing the output variable with a known type. Function 'Controlador/Controlo/Modelador/MATLAB Function1' (#248.10.12), line 1, column 11: "u1" Launch diagnostic report.
How do I solve this?Inês Correiahttps://se.mathworks.com/matlabcentral/profile/authors/11428798tag:se.mathworks.com,2005:Question/6204782020-10-20T19:55:20Z2020-10-20T20:08:43ZError "too many inout arguments" using "diary"I'm a beginner in Matlab and I'm receiving a message error saying "too many input arguments" when I try to use "diary" at the beginning of the code... I don't know what I am doing wrong. Could someone help me?
My code is
>> diary C:\Analise de Regressao\EXUnidade1.txt
Error using diary
Too many input arguments.Anadia Cattarinhttps://se.mathworks.com/matlabcentral/profile/authors/19994398tag:se.mathworks.com,2005:Question/6139412020-10-14T17:18:23Z2020-10-20T20:03:56ZIssues using Table function and changing the fonts in my editor window :2020aMy fonts in my editor window are set to a large, say 24, for teaching.
In a live script I used a T=table(). The table command worked fine. BUT the fonts in my editor window were put back to Matlab defaults.
If I use an m file rather than a script, there is no impact.
But after using table in the live script (mlx), I need to exit Matlab in order to even change the settings back.
Any clues?Rosemary Renauthttps://se.mathworks.com/matlabcentral/profile/authors/25160tag:se.mathworks.com,2005:Question/6180182020-10-18T20:25:27Z2020-10-20T20:02:28ZHow to solve two coupled differential equations using ode45.I need help to solve two paired differential equations. After hours of unsuccessful attemps, I am asking for help from you. Any suggestion will be highly appriciated.
The equations are -
m*x''(t) + U*x(t) + γ*x'(t) + kv*V(t) - ζ = 0
V'(t) - kc*x'(t) + τ*V(t) = 0
initial conditions are x(0) = 1, X'(0) = 0, V(0) =0
x and V are the variables. All others are constant.
Thanks in advance.
Musanna Galibhttps://se.mathworks.com/matlabcentral/profile/authors/18448718tag:se.mathworks.com,2005:Question/6113362020-10-12T10:46:12Z2020-10-20T20:00:41ZInstalling openexr in Matlab I am trying to install OpenExr to read .exr files but I get some error which do no understand. I have downloaded the scripts from this and this link. In the instruction file, it has been mentioned to put correct paths.
the downloaded files are located as
D:\D\ZJU Data\HDR\softwre\openexr
D:\D\ZJU Data\HDR\softwre\openexr\IlmImf
D:\D\ZJU Data\HDR\softwre\openexr\Half
D:\D\ZJU Data\HDR\softwre\openexr\Iex
D:\D\ZJU Data\HDR\softwre\openexr\IlmThread
D:\D\ZJU Data\HDR\softwre\openexr\Imath
The make.m file is modified for the paths to make the file as below
clc;
verbose = false;
% -----------------------------------------------
build_files = { 'exrinfo.cpp', ...
'exrread.cpp', ...
'exrreadchannels.cpp', ...
'exrwrite.cpp', ...
'exrwritechannels.cpp'};
companion_files = { 'utilities.cpp', ...
'ImfToMatlab.cpp', ...
'MatlabToImf.cpp'};
additionals = {};
if(verbose == true)
additionals = [additionals, {'-v'}];
end
for n = 1:size(build_files, 2)
if(verbose == true)
clc;
end
file = cell2mat(build_files(n));
disp(['Building ', file]);
mex(file, companion_files{:}, ...
'-D:\D\ZJU Data\HDR\softwre\openexr\OpenEXR', ...
'-D:\D\ZJU Data\HDR\softwre\openexr\', ...
'-IlmImf', ...
'-Iex', ...
'-Imath', ...
'-IHalf', ...
'-IlmThread', ...
'-largeArrayDims', ...
additionals{:});
end
clear;
disp('Finished building OpenEXR for Matlab');
But I get the foloowing error
Error using mex
g++: error: Files\MATLAB\R2018b/extern/include -IC:\Program: Invalid argument
g++: error: Files\MATLAB\R2018b/simulink/include -fexceptions -fno-omit-frame-pointer -std=c++11 -O2 -fwrapv -DNDEBUG D:\D\ZJU: Invalid argument
g++: error: Data\HDR\softwre\openexr\exrinfo.cpp -o C:\Users\IMRANK~1\AppData\Local\Temp\mex_230748490719102_4660\exrinfo.obj : Invalid argument
g++: fatal error: no input files
compilation terminated.
I am using MinGW64 compiler.
Can you please tell me what exactly is the error? Imran Kanjoohttps://se.mathworks.com/matlabcentral/profile/authors/2445678tag:se.mathworks.com,2005:Question/6204832020-10-20T19:59:29Z2020-10-20T19:59:29ZHow to gaussian white noise with mean, variance and autocorrelation function?I want to input a white gaussian noise (ζ_z )in my system with mean = 0, variance, σ= 3,6 and 12*10^-4 and exponential autocorrelation function with correlation time 𝜏 =0.1. Can anyone help me with this?
The equations are given as-
Musanna Galibhttps://se.mathworks.com/matlabcentral/profile/authors/18448718tag:se.mathworks.com,2005:Question/6203232020-10-20T16:43:04Z2020-10-20T19:57:44ZUnable to properly feedback an updated signal in simulinkHello,
I'm trying to make a toy example work using simulink. I have a particle that i want to go in a circle. Basically what I want to do is to rotate progressively by 10 deg over 36 sec (so it makes a full circle).
How to code this in simulink? For the rotation, I used the 2d rotation matrix about z. I am basically having trouble feeding back the updated velocity as the new reference.
Anthony Maaloulyhttps://se.mathworks.com/matlabcentral/profile/authors/7400343tag:se.mathworks.com,2005:Question/6201232020-10-20T13:32:30Z2020-10-20T19:56:26ZMaclaurin series for ln(x) and ln(x+1)Greetings,
I am trying to find maclaurin series for ln(x) and ln(1+x),
Can anyone help me how to do them on matlab?
Thanks,Ghath Al Hafezhttps://se.mathworks.com/matlabcentral/profile/authors/19987763tag:se.mathworks.com,2005:Question/6193232020-10-19T20:59:03Z2020-10-20T19:54:13ZComputing findpeaks along 3-Dimensional matrixI have a 3-dimensional matrix, after some code manipulation on a cell array. The matrix is of size 101x151x476.
The first number represents the y space, the second number is the x space, and the third number is the number of time steps. So essentially, the matrix contains magnitudes along a y-x plane, for varying timesteps.
I am trying to compute the peaks at each (y,x) across the timesteps. I am doing this using findpeaks. This is what I have so far:
for yIndex= 1:1:101
for xIndex= 1:1:151
[peaks{y,x}] = findpeaks(a3Dmatrix(yIndex,xIndex,:));
end
end
However, the cell "peaks" is incorrect, as it is not of the size 101x151 (y by x). Any help with this?
Vivekhttps://se.mathworks.com/matlabcentral/profile/authors/12091887tag:se.mathworks.com,2005:Question/6087712020-10-09T00:37:00Z2020-10-20T19:53:18ZSolving a diffusion-reaction equation using method of linesHi all, I am trying to solve a diffusion-reaction equation (under cylindrical co-ordinate) using method of lines (MOL). The partial differential equation, initial and boundary conditions, and the corresponding derivations can be seen in the attachment. The corresponding code has also been uploaded. I also simulated the PDE using the pde solver in Matlab, and found that my MOL code cannot obtain the right results. Moreover, what weird is that the results of MOL depend on the number of spatial grids (the variable n in my code). I have checked my code many times and did not find any errors. Can anyone help me with this? Thanks in advance.Dadi Bihttps://se.mathworks.com/matlabcentral/profile/authors/13974890tag:se.mathworks.com,2005:Question/6204732020-10-20T19:52:32Z2020-10-20T19:52:32Zcode to detection the cars this code not counting cars properly How do i make it count correct ?clc;
clear all;
MV = imread('cars1.png'); %To read image
MV1 = imread('backgnd.png');
A = double(rgb2gray(MV));%convert to gray
B= double(rgb2gray(MV1));%convert 2nd image to gray
[m1,n1,p1] = size(A);
[m2,n2,p2] = size(B);
m = max(m1,m2) ;
n = max(n1,n2) ;
A = imresize(A,[m n]) ;
B = imresize(B, [m n]) ;
[height, width] = size(A); %image size?
h1 = figure(1);
%Foreground Detection
thresh=11;
fr_diff = abs(A-B);
for j = 1:width
for k = 1:height
if (fr_diff(k,j)>thresh)
fg(k,j) = A(k,j);
else
fg(k,j) = 0;
end
end
end
subplot(2,2,1) , imagesc(MV), title (['Orignal Frame']);
subplot(2,2,2) , imshow(mat2gray(A)), title ('converted Frame');
subplot(2,2,3) , imshow(mat2gray(B)), title ('BACKGND Frame ');
sd=imadjust(fg);% adjust the image intensity values to the color map
level=graythresh(sd);
m=imnoise(sd,'gaussian',0,0.025);% apply Gaussian noise
k=wiener2(m,[5,5]);%filtering using Weiner filter
bw=im2bw(k,level);
bw2=imfill(bw,'holes');
bw3 = bwareaopen(bw2,5000);
labeled = bwlabel(bw3,8);
cc=bwconncomp(bw3);
Densityoftraffic = cc.NumObjects/(size(bw3,1)*size(bw3,2));
blobMeasurements = regionprops(labeled,'all');
numberofcars = size(blobMeasurements, 1);
subplot(2,2,4) , imagesc(labeled), title (['Foreground']);
hold off;
disp(numberofcars);% display number of cars
disp(Densityoftraffic);%display number of vehiclesJeje Ahmadhttps://se.mathworks.com/matlabcentral/profile/authors/19993623tag:se.mathworks.com,2005:Question/6204282020-10-20T18:43:00Z2020-10-20T19:50:01ZHow to extract matrix with different starting index for each row?I am not sure how to extract from a matrix a smaller matrix with different starting index for each row.
For example,
Original matrix (4x5):
[1 2 3 4 5]
[6 7 8 9 10]
[11 12 13 14 15]
[16 17 18 19 20]
Desired output (4,3):
[2 3 4]
[6 7 8]
[13 14 15]
[17 18 19]
where the starting index for each row is [2,1,3,2]
Thank you!Katherine Liuhttps://se.mathworks.com/matlabcentral/profile/authors/11400991tag:se.mathworks.com,2005:Question/6204682020-10-20T19:45:25Z2020-10-20T19:45:25ZSimulink Arduino I2c R2019 a errorHello guys,
I received this error and i have no clue what to do.
MATLAB System block 'mpu6050/Subsystem/I2C Read' error occurred when invoking 'stepImpl' method of 'codertarget.arduinobase.internal.arduinoI2CRead'. The error was thrown from ' 'C:\ProgramData\MATLAB\SupportPackages\R2019a\toolbox\target\shared\ioserver\+matlabshared\+ioclient\+peripherals\I2C.p' at line 0 'C:\ProgramData\MATLAB\SupportPackages\R2019a\toolbox\target\shared\ioserver\+matlabshared\+ioclient\+peripherals\I2C.p' at line 0 'C:\ProgramData\MATLAB\SupportPackages\R2019a\toolbox\target\supportpackages\arduinobase\+codertarget\+arduinobase\+internal\arduinoI2CRead.p' at line 0 'C:\ProgramData\MATLAB\SupportPackages\R2019a\toolbox\target\shared\svd\+matlabshared\+svd\I2CBlock.p' at line 0'.
Thank you!Ionut Tidreahttps://se.mathworks.com/matlabcentral/profile/authors/19078096tag:se.mathworks.com,2005:Question/6204582020-10-20T19:42:15Z2020-10-20T19:42:15ZCreate 3D objects and save as image stack (tiff)Hello,
Some context:
I am working with an algorithm that evaluates contact angles of a liquid on a surface. It requires a segmented image stack (.tiff) as an input.
To verify that the algorithm is working correctly, I want to input a segmented image stack of an artificial sphere (representing a droplet of liquid) on an artificial rectangular prism (representing the surface). Depending on where the intersection of the two is chosen, we can analytically determine the contact angle of the sphere, and see if algorithm outputs the expected result.
I am new to creating 3D objects in Matlab. I understand that I can create a sphere in matlab using the
sphere
function. But I am not sure how I can then create a rectangular prism and have it 'merge' with the sphere (see below).
So, two parts to my question. First, how can I generate the object I drew above? Second, how can I convert it as a stack of 2D images (.tiff format)?
Thanks in advance.
ChrisChristopher Liuhttps://se.mathworks.com/matlabcentral/profile/authors/13848343tag:se.mathworks.com,2005:Question/6204532020-10-20T19:41:26Z2020-10-20T19:41:26ZCustom deep learning loop take more memory than using trainNetwork()?Hi,
I followed the instructions from the link below to create a custom training loop by using a U-Net architecture.
https://www.mathworks.com/help//deeplearning/ug/train-network-using-custom-training-loop.html
By the same network architecture and with same "multi-gpu" setting (I have 2 RTX 2060 GPU), I found that I can only take 4 minibatch size at best in the custom training loop, while 16 minibarch size at best by using the built-in trainNetwork() function.
Is this a normal phenomenon that custom loop training will take more gpu memory than trainNetwork()?
Thanks!Qiao Huhttps://se.mathworks.com/matlabcentral/profile/authors/13589055tag:se.mathworks.com,2005:Question/6204482020-10-20T19:37:47Z2020-10-20T19:37:47Zcode to detection the cars this code not counting cars properly How do i make it count correct ?clc;
clear all;
MV = imread('cars1.png'); %To read image
MV1 = imread('backgnd.png');
A = double(rgb2gray(MV));%convert to gray
B= double(rgb2gray(MV1));%convert 2nd image to gray
[m1,n1,p1] = size(A);
[m2,n2,p2] = size(B);
m = max(m1,m2) ;
n = max(n1,n2) ;
A = imresize(A,[m n]) ;
B = imresize(B, [m n]) ;
[height, width] = size(A); %image size?
h1 = figure(1);
%Foreground Detection
thresh=11;
fr_diff = abs(A-B);
for j = 1:width
for k = 1:height
if (fr_diff(k,j)>thresh)
fg(k,j) = A(k,j);
else
fg(k,j) = 0;
end
end
end
subplot(2,2,1) , imagesc(MV), title (['Orignal Frame']);
subplot(2,2,2) , imshow(mat2gray(A)), title ('converted Frame');
subplot(2,2,3) , imshow(mat2gray(B)), title ('BACKGND Frame ');
sd=imadjust(fg);% adjust the image intensity values to the color map
level=graythresh(sd);
m=imnoise(sd,'gaussian',0,0.025);% apply Gaussian noise
k=wiener2(m,[5,5]);%filtering using Weiner filter
bw=im2bw(k,level);
bw2=imfill(bw,'holes');
bw3 = bwareaopen(bw2,5000);
labeled = bwlabel(bw3,8);
cc=bwconncomp(bw3);
Densityoftraffic = cc.NumObjects/(size(bw3,1)*size(bw3,2));
blobMeasurements = regionprops(labeled,'all');
numberofcars = size(blobMeasurements, 1);
subplot(2,2,4) , imagesc(labeled), title (['Foreground']);
hold off;
disp(numberofcars);% display number of cars
disp(Densityoftraffic);%display number of vehiclesJeje Ahmadhttps://se.mathworks.com/matlabcentral/profile/authors/19993623tag:se.mathworks.com,2005:Question/6190282020-10-19T15:24:15Z2020-10-20T19:34:18ZUnable to perform assignmentFrom my attached code and get the following error:
"Unable to perform assignment because the size of the left side is 5689-by-1 and
the size of the right side is 5689-by-2."
clear
clc
close all
%% Time Series Data
filename = 'JCl_Daily.xlsx';
% read the data set
[ num, txt, raw ] = xlsread(filename);
txt = txt(3:end, :);
raw = raw(3:end, :);
mgdata = zeros(length(num),2);
mgdata(:,1) = 1:length(num) ;
mgdata(:,2) = num ;
% load mgdata.dat
%learning data construction
time = mgdata(:, 1) ;
x = mgdata(:, 2);
plot(time,x,'-r')
title('Mackey-Glass Chaotic Time Series')
xlabel('Time (sec)')
ylabel('x(t)')
%% Preprocess Data
for t = 19:length(num)-6
Data(t-17,:) = [x(t-18) x(t-12) x(t-6) x(t) x(t+6)];
end
trnData = Data(1:900,:);
chkData = Data(901:end,:);
%% Build Initial Fuzzy System
fis = genfis(trnData(:,1:end-1),trnData(:,end),...
genfisOptions('GridPartition'));
figure
subplot(2,2,1)
plotmf(fis,'input',1)
subplot(2,2,2)
plotmf(fis,'input',2)
subplot(2,2,3)
plotmf(fis,'input',3)
subplot(2,2,4)
plotmf(fis,'input',4)
%% Train ANFIS Model
options = anfisOptions('InitialFIS',fis,'ValidationData',chkData);
[fis1,error1,ss,fis2,error2] = anfis(trnData,options);
figure
subplot(2,2,1)
plotmf(fis2,'input',1)
subplot(2,2,2)
plotmf(fis2,'input',2)
subplot(2,2,3)
plotmf(fis2,'input',3)
subplot(2,2,4)
plotmf(fis2,'input',4)
%% Plot Errors Curves
figure
plot([error1 error2])
hold on
plot([error1 error2],'o')
legend('Training error','Checking error')
xlabel('Epochs')
ylabel('Root Mean Squared Error')
title('Error Curves')
%% Compare Original and Predicted Series
anfis_output = evalfis(fis2,[trnData(:,1:4); chkData(:,1:4)]);
figure
index = 24:length(num);
plot(time(index),anfis_output,'-b')
hold on
plot(time,x,'-r')
xlabel('Time (sec)')
legend('ANFIS Prediction','Initial Time Series' )
%% error evaluation
figure
diff = x(index) - anfis_output;
plot(time(index),diff)
xlabel('Time (sec)')
title('Prediction Errors')
Mehmet Sahinerhttps://se.mathworks.com/matlabcentral/profile/authors/17999831tag:se.mathworks.com,2005:Question/6139012020-10-14T16:40:19Z2020-10-20T19:32:12ZDICOM Image Color ValuesI am relatively new to Matlab, and I am working with a dicom image. It is all in grayscale. The values on the image currently to all the way up into the 2000s (when I look at the colors in imtool). My questions are how do I switch the image to either a 0-1 color scale, or a 0-255 color scale. My second questions is, how do I figure out if the image is in HSV or RGB format currently?
Thank you.Lydia Leehttps://se.mathworks.com/matlabcentral/profile/authors/19358960tag:se.mathworks.com,2005:Question/5172442020-04-12T03:26:00Z2020-10-20T19:27:48ZKenyan Eliud Kipchoge set a new world record for men of 2:01:39 on September 16, 2018. Assign his average speed in km/h to the variable marathon. The marathon distance is 42.195 kilometers? How to Calculate ?Kenyan Eliud Kipchoge set a new world record for men of 2:01:39 on September 16, 2018. Assign his average speed in km/h to the variable marathon. The marathon distance is 42.195 kilometers.Muhammad Iqbalhttps://se.mathworks.com/matlabcentral/profile/authors/4853598tag:se.mathworks.com,2005:Question/6121262020-10-13T03:08:03Z2020-10-20T19:25:07ZImage Edge Detection using Sobel Operator I am working on an assignment where I have to detect image edge using Sobel operator. It was stated that the output image must be uint8 format and has two fewer rows and columns than the input one, since the pixels in first and last columns and rows do not have enough neughbors for the required computation. I am struggling in the last part as I get same input and ouput size. I would apperciate your help and suggestions. I have attached my code for your reference.
function [edge] = edgy(cc)
cc = double(cc);
H = size(cc,1);
W = size(cc,2);
edge = cc;
sx = [-1 0 1;-2 0 2;-1 0 1];
sy = [1 2 1;0 0 0;-1 -2 -1];
for i = 2 : H-1
for j = 2 : W-1
A = cc(i - 1 : i + 1, j - 1 : j + 1);
a = (sum(sx .* A));
x = sum(a);
b = (sum(sy .* A));
y = sum(b);
pixValue =sqrt(x.^2+ y.^2);
edge(i, j) = pixValue;
end
end
edge = uint8(edge);
end Osama Ahmedhttps://se.mathworks.com/matlabcentral/profile/authors/16748303tag:se.mathworks.com,2005:Question/6203932020-10-20T18:11:46Z2020-10-20T19:23:24Zhow to assign colour to a double plot by clicking on graph in UIAxes appdesinger Matlab (R2020a)?hello, my objective is to assign different colour to a double plot of own choice. if i have three variable data...
a= [1 2 3]
b = [4 5 7]
c = [7 8 9]
plot(a,b);
hold(app.UIAxes,'on')
plot (a.c)
% this will give us double plot... now one way to assign colour to plot is >>> plot(a,b,"color",'red') and plot(a,c,"color",'blue').
% second way is to throug "drop down" for example >>> SelectColour = app.dropdown.Value and then use plot(a,b,"colour",'SelectedColout')... with above two ways i succesfully assigned colour....
% third is to use default colour sequence... but i want user selected colour for every plot.
The above was just to show that i made effort but in first case we cannot change colour and in second case it changes colour for every graph. it should be coded such it saves colour assigned then assign next colour via dropdown
or
on "UIAxes" when i double click and assign any colour to first plot then any second colour to other plot.... Kindly Guide.taimour sadiqhttps://se.mathworks.com/matlabcentral/profile/authors/17895697tag:se.mathworks.com,2005:Question/6202832020-10-20T15:47:15Z2020-10-20T19:15:10ZHow to plot min and max values on graphI've created some formulas and a function that is composed of if and elseif statements and plots a graph of it. However I am needing for the graph to show the max and min of the curve and I am unsure of how to do so.
X = 0:0.1:10;
Y = (X.^(1.01))+4*cos((3/4).*X.*pi) - 2*sin((2/3)*pi.*X)-0.25;
figure(); %creates figure window
plot (Y,'-r+') %plots figure
xlabel('Time (mins)') %x axis label
ylabel('Density Altitude (km)') %y axis label
function minmax_i = min_max(Y) %function code
N = ones(1,7);
for i = 2:(length(Y)-1)
if (Y(i-1) > Y(i)) && (Y(i+1) > Y(i)) %if true, local minimum
minmax_i(N) = i;
N = N+1;
elseif (Y(i-1) < Y(i)) && (Y(i+1) < Y(i)) %if true, local maximum
minmax_i(N) = i;
N = N+1;
end
end
endNoah Johnsonhttps://se.mathworks.com/matlabcentral/profile/authors/19281105tag:se.mathworks.com,2005:Question/6192682020-10-19T20:14:29Z2020-10-20T19:08:11Zboundary condition function handle not working for scanning heat source I'm using the PDE toolbox to do transcient thermal modeling.
Using the following 2 lines works:
beam_width = @(region,state) (xmax-region.x<d(1)/2 & abs(region.y-V*state.time)<d(2)/2)*q;
thermalBC(thermalmodelT,'Face',6,'HeatFlux',beam_width)
where q is a W/m2 heat source & V is velocity.
I'm trying to replace the above 2 lines with
beam_width = @(region,state) (xmax-region.x<d(1)/2 & abs(region.y-V*state.time)<d(2)/2)*1400;
thermalBC(thermalmodelT,'Face',6,'Temperature',beam_width);
have feedback to keep the surface temperature as a fixed value as I scan my laser beam, but using 'Temperature', the boundary condition isn't moving with time like it does using 'HeatFlux'.
Do you know how to get this to work? Thanks.Brian Olmstedhttps://se.mathworks.com/matlabcentral/profile/authors/18945396tag:se.mathworks.com,2005:Question/6203332020-10-20T17:12:33Z2020-10-20T19:07:00ZError in running loop for importing .cnt data file for multiple filesHello,
I am attempting to run a simple loop through EEGlab and am able to run each line of code individually but I encounter an error in an attempt to run a loop that imports, runs localization command, and save. The first subject can correctly be called and saved, however, when moving on to the next subject my script is unable to do so due to the following three errors:
Thank you in advance!
eeglab: options file is ~/eeg_options.m
EEGLAB warning: there can be only one EEGLAB window, closing old one
Retrieving plugin versions from server...
Retreiving download statistics...
EEGLAB: adding "Fieldtrip-lite" to the path; subfolders (if any) might be missing from the path
EEGLAB: adding "ICLabel" v1.2.6 (see >> help eegplugin_iclabel)
EEGLAB: adding "clean_rawdata" v2.2 (see >> help eegplugin_clean_rawdata)
EEGLAB: adding "dipfit" v3.3 (see >> help eegplugin_dipfit) - new version 3.4 available
EEGLAB: adding "eeglab_plugin_aar-master" v? (see >> help eegplugin_aar)
EEGLAB: adding "firfilt" v2.4 (see >> help eegplugin_firfilt)
EEGLAB: adding "neuroscanio" v1.3 (see >> help eegplugin_neuroscanio)
You are using the latest version of EEGLAB.
Error using fread
Invalid file identifier. Use fopen to generate a valid file identifier.
Error in loadcnt (line 111)
h.rev = fread(fid,12,'char');
Error in pop_loadcnt (line 130)
r = loadcnt( fullFileName, varargin{:});
here is a copy of my script:
homefolder = '/Volumes/Backup Plus/BMC_Data/YA_CNT_Files';
datafolder = '/Volumes/Backup Plus/BMC_Data/YA_CNT_Files';
cd(datafolder);
Files = dir('*.cnt');
cd(datafolder);
for i=1:length(Files)
[ALLEEG, EEG, ~, ALLCOM] = eeglab;
FileName = Files(i).name;
cd(datafolder);
thisfilename = FileName;
Ind1 = find(FileName == '.');
basefilename = thisfilename(1:Ind1-1);
EEG = pop_loadcnt('thisfilename', 'dataformat', 'auto', 'memmapfile', '');
EEG.setname= [basefilename '.set'];
[ALLEEG, EEG, CURRENTSET] = pop_newset(ALLEEG, EEG, 0,'setname',EEG.setname,'gui','off');
EEG = eeg_checkset( EEG );
[ALLEEG, EEG, CURRENTSET] = eeg_store(ALLEEG, EEG);
eeglab redraw
counter = 1;
EEG=pop_chanedit(EEG, 'lookup','/Users/lpez/Documents/MATLAB/eeglab2020_0/plugins/dipfit/standard_BESA/standard-10-5-cap385.elp');
EEG = eeg_checkset( EEG );
[ALLEEG, EEG] = eeg_store(ALLEEG, EEG, CURRENTSET);
EEG.setname = [basefilename '_1.set'];
pop_saveset( EEG, 'filename',EEG.setname,'filepath', datafolder);
clear EEG ALLEEG CURRENTSET
end
Luke Pezankohttps://se.mathworks.com/matlabcentral/profile/authors/18919732tag:se.mathworks.com,2005:Question/6201332020-10-20T13:36:50Z2020-10-20T19:04:39ZHow to measure a crack length (using skeleton function)?I am trying to calculate the length of the crack (attached) however I can't figure out a way to remove the extra sections of the skeleton that branch off from the main crack path - crackoverlay.png.
Does anyone have any advice as to how I could do this?
clc
clear variables
RGB = imread('crack2.jpg'); % Aquires original image
I = rgb2gray(RGB); % Creates greyscale image
BW = imbinarize(I,'global'); % Binarises it
BW2 = ~(bwmorph(BW,'majority',Inf)); % Fills in holes
BW3 = bwmorph(BW2,'skel',Inf); % Reduces image to center areas of the white sections
BW4 = bwmorph(BW3,'spur',Inf); % Removes spurs
Ov = imfuse(RGB,BW4); % Overlay of original image and skeleton
figure('Name','All_Steps')
subplot(3,2,1), imshow(RGB), title('Original Image')
subplot(3,2,2), imshow(BW) , title('Binarised Image')
subplot(3,2,3), imshow(BW2), title('Binarised Inverted')
subplot(3,2,4), imshow(BW3), title('Skeleton')
subplot(3,2,5), imshow(BW4), title('Simplified Skeleton')
subplot(3,2,6), imshow(Ov), title('Overlay')Thomas Bainbridgehttps://se.mathworks.com/matlabcentral/profile/authors/20028418tag:se.mathworks.com,2005:Question/6194782020-10-20T01:10:24Z2020-10-20T19:01:31ZPlotting a rankine half bodyI'm trying to plot a rankine half body, a flow field formed by superposition of a horizontal uniform flow and a source flow. The figure turned out to be a mess, I don't know how I should fix it. Here are my codes:
clc;
clear all;
m=3; %strength
U = 30;%positive x-axis
%Mesh for fourth quadrant and corresponding stream value function
[X1,Y1] = meshgrid(.05:.1:30,-30:.1:-.05);
psi1 = U*Y1 + (m/(2*pi))*atan(Y1./X1);
%Mesh for first quadrant and corresponding stream value function
[X2,Y2] = meshgrid(.05:.1:30,.05:.1:30);
psi2 = U*Y2 + (m/(2*pi))*atan(Y2./X2);
%Mesh for second quadrant and corresponding stream value function
[X3,Y3] = meshgrid(-30:.1:-.05,.05:.1:30);
psi3 = U*Y3 + (m/(2*pi))*atan(Y3./X3);
%Mesh for third quadrant and corresponding stream value function
[X4,Y4] = meshgrid(-30:.1:-.05,-30:.1:-.05);
psi4 = U*Y4 + (m/(2*pi))*atan(Y4./X4);
figure (1)
A='on';
B = 2;
C = 2.5;
contour(X1,Y1,psi1,'k','showtext',A,'textstep',B,'levelstep',C);
hold on;
contour(X2,Y2,psi2,'k','showtext',A,'textstep',B,'levelstep',C);
hold on;
contour(X3,Y3,psi3,'k','showtext',A,'textstep',B,'levelstep',C);
hold on;
contour(X4,Y4,psi4,'k','showtext',A,'textstep',B,'levelstep',C);
hold off;
xlim([-30 30]);ylim([-30 30]);
xlabel('X');ylabel('Y');
grid on;
'''
Here is the figure I got:
However, it should at least look something like this:
Randy Chenhttps://se.mathworks.com/matlabcentral/profile/authors/16878431tag:se.mathworks.com,2005:Question/6204332020-10-20T18:43:40Z2020-10-20T18:56:38ZI am trying to write a recursive code to check whether a string is palindrome or not, when i am running a trial case a error message shows up stating "he function call palindrome('madam') caused an error and did not complete (MATLAB:TooManyOutputs)".% I am writing a code to find the palindrome of a string using recursion but i am getting the error The function call palindrome('madam') caused an error and did not complete (MATLAB:TooManyOutputs)
function palindrome(v)
if length(v) <= 1
true
return;
end
if v(1) ~= v(end)
false
return;
end
palindrome(v(2:end-1));
endHarsh Mittalhttps://se.mathworks.com/matlabcentral/profile/authors/17367435tag:se.mathworks.com,2005:Question/4844892019-10-09T23:57:19Z2020-10-20T18:56:16ZDamped harmonic motion curve fitHey,
I have a data set in matlab, when plotted it looks like this:
My goal is to determen a damped sinusoidal equation that would fit this data set, I honestly dont even know how to start. I have included my code, but it isn't much.Any help is much appreciated. Thank you!Stashu Kozlowskihttps://se.mathworks.com/matlabcentral/profile/authors/16224801tag:se.mathworks.com,2005:Question/6204432020-10-20T18:53:12Z2020-10-20T18:53:12ZI Have Problems with Generalized Fourier SeriesI am trying to apply a code to generate the Generalized series graph of the following Function
Through the following code:
clear all ;clc;
syms x n pi
% pi=3.14;
sum = 0;
y = piecewise(-2 < x <2, 1, 2<x,0,x<-2,0, 2); %function you want
a0=(1/pi)*int(y,x,-2,2);
for n=1:7
%finding the coefficients
fn=(1/pi)*int(y*cos(n*x*(pi/4)),x,-2,2);
sum = a0/2+(fn*cos(n*x*(pi/4)));
end
ylim([0 1.5]);
fplot(y,[-4,4]);
grid on;hold on;
fimplicitplot(x,(sum+a0/2),[-4,4]);
grid on;
But MathLab outputs some errors, how can i fix it ?William Kamimurahttps://se.mathworks.com/matlabcentral/profile/authors/20052887tag:se.mathworks.com,2005:Question/5916492020-09-10T11:11:01Z2020-10-20T18:51:54Zrecursive function to check a Palindromefunction out=palindrome(x)
n=numel(x);
if n==1
out=true;
else
Can anyone continue from here?Urmish Haribhaktihttps://se.mathworks.com/matlabcentral/profile/authors/12953445tag:se.mathworks.com,2005:Question/6146832020-10-15T09:43:34Z2020-10-20T18:48:43ZHow to prevent override with double data type on certain block when deriving simulation ranges with Fixed-point ToolHello Community
I'm using Simulink's Fixed-point Tool to optimize my design. There is a manually optimized part in my design, i.e. it alrady uses the best possible data types. I want the Fixed-point tool to ignore this part during optimization. Therefore, I checked the "Lock ouput data type setting against changes by the fixed-point tool" on all blocks in this part.
I want to derive the signal ranges by simulation. If I now start the iterative conversion, then all signals are overritten with the double data type. This is fine but the problem is that Simulink also does this on my already optimized part mentioned above. My optimized part contains of bit operations, e.g. logical left shift blocks. Now I get an error because those blocks do not work with double data types.
How can I prevent Simulink from overriding those signals not only during the optimization process, but also when deriving signal ranges?
Dominik Hiltbrunnerhttps://se.mathworks.com/matlabcentral/profile/authors/17621751tag:se.mathworks.com,2005:Question/6204382020-10-20T18:48:04Z2020-10-20T18:48:04ZHow to convert lidar data in .bin format to .pcd or .pcap ?I have downloaded a dataset named PREVENTION DATASET, it has lidar data which has .bin as extension.
Is there any way to visualise .bin format lidar data in MATLAB ?
If not how to convert lidar data in .bin format to .pcd or .pcap ?Sudheer Dunnahttps://se.mathworks.com/matlabcentral/profile/authors/17650911tag:se.mathworks.com,2005:Question/4661072019-06-08T08:09:49Z2020-10-20T18:47:57ZHow to create a T1 MapHello,
I am reasonably new to matlab and was wondering if anyone had any ideas on how to create a T1 map for MRI images.
I know I need to create a for loop so that it applys the T1 equation to every pixel in the image, and have a matrix of 0's to put the data into however I am not sure how to put this into action.
I have created the for loop but the equation I have used previously to create an inversion recovery curve does not seem to be compatible. woudl anyone know the equation that I can apply per pixel to create the T1 map?
Thanks
Lydia Smithhttps://se.mathworks.com/matlabcentral/profile/authors/15105566tag:se.mathworks.com,2005:Question/6204232020-10-20T18:40:23Z2020-10-20T18:40:23ZHow to batch convert to C/C++ using Coder App?Hi,
I have a large Matlab package that consists of hundreds of m files. They are in several folders, some start with '+'.
How do I batch convert them to C/C++ using Coder App? Do I have to run Coder App one-by-one?
Thanks.shawn gonghttps://se.mathworks.com/matlabcentral/profile/authors/20052793tag:se.mathworks.com,2005:Question/6204182020-10-20T18:38:18Z2020-10-20T18:38:18ZHow to edge detection and count functions without sobel operator for some objects. exp. square figures ? Somebody know any algorithm about that?How to edge detection and count functions without sobel operator for some objects. exp. square figures ? Somebody know any algorithm about that?Abdulkadir Cildirhttps://se.mathworks.com/matlabcentral/profile/authors/20048357tag:se.mathworks.com,2005:Question/6203482020-10-20T17:19:45Z2020-10-20T18:37:13ZMultiplying two columns from two excel sheets in MATLABHello there,
I have two excel files. In both files, I have two coumns in each file. In one column the values are time values(x-axis) and the other column is my data(y-axis) at corresponding time values. This scenario is true for both the files. The time data range is same in both the coumns of both the excel files. Now I want to multiply the the data values (in y-asis) of both files with each other keeping the time range as it is. I mean, I just want to multuply the y-columns (or 2nd) column of both the excel files with each other.
It would be great if anyone could provide a MATLAB code for this operation. Any kind of help would be highly appreciated.
Thank youKefayet Ullahhttps://se.mathworks.com/matlabcentral/profile/authors/16417976