https://www.mathworks.com/matlabcentral/answers/questionsMATLAB Answers — New Questions2021-01-21T09:29:45Ztag:www.mathworks.com,2005:Question/7228182021-01-21T08:37:25Z2021-01-21T09:28:42ZFor loop: access values in between stepsHi
I have a for-loop where first only certain rows of a matrix are dealt with:
for i = 1:3:100 %3 is an example step size, the step size is a variable in the program
%do something with rows 1, 4, 7, 10, 13, 16 ...
end
After this, the remaining rows, i.e. rows 2,3, 5,6, 8,9, ... need to be filled up using the data in the rows calculated above. I don't see which would then be the most optimal method to define this new for loop. Possibly, for loops aren't even the best way to approach this? Thanks for your input! Simon Allosseriehttps://www.mathworks.com/matlabcentral/profile/authors/19903548tag:www.mathworks.com,2005:Question/7227232021-01-21T04:36:29Z2021-01-21T09:28:16ZHi all! Could you please help me understand this piece of code here?%% setup
hold all
a = arduino('COM3', 'Uno');
mpu = i2cdev(a,'0x68'); %mpu adress is normally 0x68
writeRegister(mpu, hex2dec('B6'), hex2dec('00'), 'int16'); %reset
data = zeros(10000,14,'int8'); %prelocating for the speed
j = 1;
a1 = animatedline('Color',[1 0 0]);
a2 = animatedline('Color',[0 1 0]);
a3 = animatedline('Color',[0 0 1]);
legend('Accel_x','Accel_y','Accel_z')
%% loop
while(true)
x=1;
for i=59:72 % 14 Data Registers for Accel,Temp,Gyro
data(j,x) = readRegister(mpu, i, 'int8');
x = x + 1;
end
y = swapbytes(typecast(data(j,:), 'int16')) %if your system is big-endian remove the swapbytes function
addpoints(a1,j,double(y(1)));
addpoints(a2,j,double(y(2)));
addpoints(a3,j,double(y(3)));
j = j+1;
drawnow limitrate
endWAN NOR NAZIRA MUSTAPA KAMALhttps://www.mathworks.com/matlabcentral/profile/authors/20727395tag:www.mathworks.com,2005:Question/7208942021-01-19T09:30:26Z2021-01-21T09:28:13ZHow can I remove the additive periodical noise from the image?I got an image (Project1.png) that had been corrupted by periodical noise A= 20 * sin(0.1*pi*x+0.1*pi*y). Try to remove the noise by apply the DFT on the image and multiple with the design filter (FilterImage.jpg) that I been created then inverse back to get the filtered image. But its seem like the final image not remove the noise at all. Any idea how to remove it or suggestion on how to do it? The design filter I created was basically based on the DFT of the noise (F=fft2((A)); Fs=(fftshift(F));) Thanks
clear all;
close all;
clc;
[filename, pathname]=uigetfile('*.*','Select Grey Scale Image');
filewithpath=strcat(pathname,filename);
img=imread(filewithpath);
[row,col]=size(img)
F=fft2(double(img)); %DFT of Image
Fs=fftshift(F); %Shifting Spectrum to Centre
% Getting H(u,v) - Filter
H=imread('FilterImage.jpg');
H=double(H/255);
Fsf=Fs.*H;
%Inverse DFT
fimg=ifft2(fftshift(Fsf));
imgr=uint8(real(fimg));
subplot(221);
imshow(img);
subplot(222);
imshow(log(1+abs(Fs)),[]);
subplot(223);
imshow(imgr, []);
subplot(224);
imshow(log(1+abs(Fsf)),[]);APhttps://www.mathworks.com/matlabcentral/profile/authors/20290068tag:www.mathworks.com,2005:Question/1022202011-12-16T16:59:00Z2021-01-21T09:17:48ZHow do I place errorbars on my grouped bar graph using function ERRORBAR in MATLAB?I use the following to create a grouped bar graph:
model_series = [10 40 50 60; 20 50 60 70; 30 60 80 90];
model_error = [1 4 8 6; 2 5 9 12; 3 6 10 13];
bar(model_series, 'grouped');
hold on
errorbar( model_series,model_error)
The result is a grouped bar graph with error bars placed in between each group of bars:
<<http://www.mathworks.com/matlabcentral/answers/uploaded_files/303809/1321b2d0ee66436aab32f2490f6e6f8d.png>>
I would like to have "errorbar" place error bars on the center of each bar.MathWorks Support Teamhttps://www.mathworks.com/matlabcentral/profile/authors/4622813tag:www.mathworks.com,2005:Question/7228132021-01-21T07:56:47Z2021-01-21T09:14:51ZHow to combine Space and dot expressions in Matlab? I'm trying to include blank spaces and a dot above the greek letter psi in one label.
The command for allowing spacing is (with missing dot above psi):
plot(1:10)
ylab = sprintf('$\\psi%s [deg/s]$', repmat('\ ',1,1));
ylabel(ylab,'interpreter','latex');
The command for doing dots above a letter in tex is:
plot(1:10)
ylabel('$\dot{\phi}$', 'Interpreter','latex')
How do i combine those two?
Extra question: Is it possible to exclude the "[deg/s]" from the latex interpreter, so that it has the normal font of matlab plots and only the greek letter is in latex?
Kind regards, SebastianSebastian Konsekhttps://www.mathworks.com/matlabcentral/profile/authors/17822369tag:www.mathworks.com,2005:Question/7228032021-01-21T07:47:29Z2021-01-21T09:12:25ZUndefined function 'split' for input arguments of type 'char'Hello everyone, When I'm using EP_ toolkit, the above problem description appears。i used matlab2013a.Does anyone know how can i solve this problem Siqi Liuhttps://www.mathworks.com/matlabcentral/profile/authors/21041905tag:www.mathworks.com,2005:Question/7228582021-01-21T09:12:08Z2021-01-21T09:12:08ZRequirements: 1. Show the Bode plots for the plant, controller, and the total open-loop transfer functions 2. Show the step response plots from part (e) 3. Show all calculations 4. Be sure to include discussions regarding the comparison of the vaa) find the system phase margin with D(z)=1
(b) design a phase-lag controller with a dc gain of 10 that yields a system phase margin according to the first letter of your last name:
A-H 40 degrees
J-M 45 degrees
P-Z 50 degrees
(c) design a phase-lead controller with a dc gain of 10 that yields a system phase margin
according to the first letter of your last name:
A-H 40 degrees
J-M 45 degrees
P-Z 50 degrees
(d) Design a PI controller that yields a system phase margin according to the first letter
of your last name:
A-H 40 degrees
J-M 45 degrees
P-Z 50 degreesmoh mamoorrihttps://www.mathworks.com/matlabcentral/profile/authors/20808189tag:www.mathworks.com,2005:Question/7228532021-01-21T09:11:27Z2021-01-21T09:29:45ZProblem in displaying or printing final result.Hi everybody,
I need help in my codding, the code and my final results are as below:
[rYY_es_Max, rYY_es_Lags] = max(rYY_es);
[rYY_Max , rYY_Lags] = max(rYY);
[rYY_ideal_Max , rYY_ideal_Lags] = max(rYY_ideal);
Maximum_rYY_es = ['Estimated rYY_Max = ', num2str(rYY_es_Max), ' The Point of Maximization = ', num2str(m(rYY_es_Lags))];
Maximum_rYY = ['rYY_Max = ', num2str(rYY_Max), ' The Point of Maximization = ', num2str(m(rYY_Lags))];
Maximum_rYY_ideal = ['rYY_ideal_Max = ', num2str(double(rYY_ideal_Max)), ' The Point of Maximization = ', num2str(m(rYY_ideal_Lags))];
disp(Maximum_rYY_es)
disp(Maximum_rYY)
disp(Maximum_rYY_ideal
Estimated rYY_Max = 2.9497 The Point of Maximization = 0
rYY_Max = 2.9898 The Point of Maximization = 0
rYY_ideal_Max = 3 The Point of Maximization = 0
I just want to enhance the visual output; so I want to make all 'The point of Maximization = 0' sentences in line. the problem is the numbers can varry for example for the first one it can display 2.95 so I can not use Blank to fix this problem, I was just wondering if is it possible to make a Matrix of strings and numbers to make eveything in place and line or not?
or is there any other soloution to this problem?Masoud Dorvashhttps://www.mathworks.com/matlabcentral/profile/authors/20754293tag:www.mathworks.com,2005:Question/7228432021-01-21T09:09:16Z2021-01-21T09:09:16ZLow pass filter VS high pass filterI have this filter and I want to analyze it. How can I know from the plot that its a highpass filter or a lowpass filter?
Omar Abulaylahttps://www.mathworks.com/matlabcentral/profile/authors/18565470tag:www.mathworks.com,2005:Question/7228382021-01-21T09:08:39Z2021-01-21T09:08:39ZWhile Loop for control systemHi,
i go a problem with a function that i cant find any wrongs. :( sadly because i'm not a programer...
so :
function OutLoop =fcn(InSignal,ControlSignal,MaxPoint,StepIteration,MinPoint)
OutLoop=ControlSignal;
while InSignal>MaxPoint;
OutLoop=OutLoop+StepIteration;
end
while InSignal<MinPoint;
OutLoop=OutLoop-StepIteration;
end
Thats my function and the point is:
I want to control a value (InSignal) and change (OutLoop) that will change other value witch will change the InSignal.
I will explane what i mean :
So in the ControlSignal, i've got angle of current (it is equal to 0),
At the InSignal is the Voltage that i'm looking and if the voltage is greater than MaxPoint change the OutLoop witch 1st is = to ControlSignal to a value +1
So when that is done the Voltage is drop BUT if it is not enough to drop under MaxPoint to do it again.
and again and again until InSignal is not bigger the MaxPoint.
That's my point -> I change somethink ( in that case the current angle) that will change forsure the amplitude of Voltage (InSignal) Krasimir Terzievhttps://www.mathworks.com/matlabcentral/profile/authors/11473622tag:www.mathworks.com,2005:Question/1414882014-07-09T04:00:00Z2021-01-21T09:06:50ZWhere are the installers for Microsoft's Visual C++ Redistributable 2005 and 2008 libraries located?I know that MATLAB and the MATLAB Installer are dependent on several Microsoft Visual C++ Redistributable libraries. I would like to pre-install them, or need to re-install them for troubleshooting purposes. Where can I find the exact libraries that MATLAB uses? MathWorks Support Teamhttps://www.mathworks.com/matlabcentral/profile/authors/4622813tag:www.mathworks.com,2005:Question/7195702021-01-18T02:58:29Z2021-01-21T09:06:01ZHello everyone, I would like to ask a question how to parameterize data points?The method of parameterization of data points is as follows:
Wesleyhttps://www.mathworks.com/matlabcentral/profile/authors/19428999tag:www.mathworks.com,2005:Question/7156182021-01-13T09:17:25Z2021-01-21T09:04:22ZStatup script executes as a functionHi there,
I defined a startup.m script to excute when I start MatLab. I followed all of the instructions in Specify Startup Options.
When I start MatLAb, I get the following error lines
Attempt to execute SCRIPT startup as a function:
C:\Users\antho\Documents\MATLAB\StartupDir\startup.m
Hopefully the startup script does work properly! But it is very anoying to have that "error sound" and message that appears everytime I run MatLab ...
Here is my startup.m file
set(groot, ...
'defaultAxesFontSize',14, ...
'defaultAxesLabelFontSize',1.35, ...
'defaultTextFontSize',14, ...
'defaultTextFontSizeMode','manual',...
'defaultLegendFontSize',18, ...
'defaultLegendFontSizeMode','manual',...
...
'defaultTextInterpreter','latex',...
'defaultAxesTickLabelInterpreter','latex',...
'defaultLegendInterpreter','latex',...
...
'defaultLineLineWidth',2, ...
...
'defaultAxesXGrid','on', ...
'defaultAxesYGrid','on', ...
'defaultLegendBox','on', ...
'defaultLegendLocation', 'northeast',...
'defaultAxesBox', 'on' ...
)
%% Check
disp('statup.m all done!');
It isn't a function, and it should not be one!
Do anyone knows how to fix this ?
Thanks!
Anthony.
Anthony Amorosihttps://www.mathworks.com/matlabcentral/profile/authors/11176013tag:www.mathworks.com,2005:Question/7228082021-01-21T07:54:26Z2021-01-21T09:02:54Zwhy didn't the event function detect the events?Hi all! I'm solving the thermostat model, which presents the characteristic of hybrid dynamical systems, when the ith (here i=1,2) room's temperature reduces to T_ref-0.5, the thermal is off, when the ith (here i=1,2) room's temperature raises to T_ref+0.5, the thermal is on, I use the ode suits with events, but it failed, plus the program also runs a long time, about 40 seconds(performance of computer is not bad), can anyone help me to fix the problem?
This is ode45 codes, but failed.
tic
%options=odeset('Events',@Events1,'Events',@Events2,'AbsTol',1e-8,'RelTol',1e-8);
options=odeset('AbsTol',1e-8,'RelTol',1e-8);
y0 = [21;25;17];
tspan=0:1000;
[tout,yout]=ode45(@Tq_Tj,tspan, y0,options);
figure(1)
plot(tout,yout(:,1),'k');hold on
plot(tout,yout(:,2),'-.');
plot(tout,yout(:,3),'--');
legend('room1','room2','wall')
toc
function f=Tq_Tj(~,y)
C1=550;C2=600;Cw=580;R1=1.8;R2=2.2;R1w=2;R2w=2;Ta=32;p1=14;p2=14;T_ref=20;
if(y(1)>T_ref+0.5)
p1=14;
elseif(y(1)<T_ref-0.5)
p1=0;
end
if(y(2)>T_ref+0.5)
p2=14;
elseif(y(2)<T_ref-0.5)
p2=0;
end
f=[((Ta-y(1))/R1+(y(3)-y(1))/R1w-p1)/C1; ...
((Ta-y(2))/R2+(y(3)-y(2))/R2w-p2)/C2;...
((y(1)-y(3))/R1w+(y(2)-y(3))/R2w)/Cw];
end
function [g,isterminal,direction]=Events1(~,y)
T_ref=20;
g=[y(1)-(T_ref-0.5);y(1)-(T_ref+0.5)];
isterminal=[0;0];
direction=[0;0];
end
function [g,isterminal,direction]=Events2(~,y)
T_ref=20;
g=[y(2)-(T_ref-0.5);y(2)-(T_ref+0.5)];
isterminal=[0;0];
direction=[0;0];
end
this is another way to solve the problem, you can run it to get the right results.
clc
clear
tic
%为各变量赋初值
delta_q=1e-4;
q1=21;q2=25;q3=17;
x1=q1;x2=q2;x3=q3;
t=0;delta_t=0;
A=zeros(10,6);
n=0;
C1=550;C2=600;Cw=580;R1=1.8;R2=2.2;R1w=2;R2w=2;Ta=32;p1=14;p2=14;m1=1;m2=1;T_ref=20;
%C1=0.56;C2=0.28;Cw=0.2;R1=5;R2=6;R1w=3;R2w=3;Ta=20;p1=4;p2=4;m1=1;m2=1;T_ref=20;
%开始while循环
while (t<1000)
if(x1>T_ref+0.5)
m1=1;
elseif(x1<T_ref-0.5)
m1=0;
end
if(x2>T_ref+0.5)
m2=1;
elseif(x2<T_ref-0.5)
m2=0;
end
Dx1=((Ta-q1)/R1+(q3-q1)/R1w-m1*p1)/C1;
Dx2=((Ta-q2)/R2+(q3-q2)/R2w-m2*p2)/C2;
Dx3=((q1-q3)/R1w+(q2-q3)/R2w)/Cw;
DDx1=(-Dx1/R1+(Dx3-Dx1)/R1w)/C1;
DDx2=(-Dx2/R2+(Dx3-Dx2)/R2w)/C2;
DDx3=((Dx1-Dx3)/R1w+(Dx2-Dx3)/R2w);
DDDx1=(-DDx1/R1+(DDx3-DDx1)/R1w)/C1;
DDDx2=(-DDx2/R2+(DDx3-DDx2)/R2w)/C2;
DDDx3=((DDx1-DDx3)/R1w+(DDx2-DDx3)/R2w);
%求Δt1和Δt2的值
delta_t1=sqrt(2*delta_q/abs(DDx1));
delta_t2=sqrt(2*delta_q/abs(DDx2));
delta_t3=sqrt(2*delta_q/abs(DDx3));
delta_tmin=min([delta_t1 delta_t2 delta_t3]);
%比较Δt1和Δt2的大小，进而确定q1和q2谁先跃迁
if (delta_t1==delta_tmin)
delta_t=delta_t1;
t=t+delta_t;
caribe_1=-0.125*DDDx1*(exp(-2*delta_t)-1)+0.5*(DDx1+0.5*DDDx1)*delta_t^2+(Dx1-0.25*DDDx1)*delta_t;
caribe_2=-0.125*DDDx2*(exp(-2*delta_t)-1)+0.5*(DDx2+0.5*DDDx2)*delta_t^2+(Dx2-0.25*DDDx2)*delta_t;
caribe_3=-0.125*DDDx3*(exp(-2*delta_t)-1)+0.5*(DDx3+0.5*DDDx3)*delta_t^2+(Dx3-0.25*DDDx3)*delta_t;
x1=x1+caribe_1;
x2=x2+caribe_2;
x3=x3+caribe_3;
q1=x1;
q2=q2+caribe_2;
q3=q3+caribe_3;
elseif (delta_t2==delta_tmin)
delta_t=delta_t2;
t=t+delta_t;
caribe_1=-0.125*DDDx1*(exp(-2*delta_t)-1)+0.5*(DDx1+0.5*DDDx1)*delta_t^2+(Dx1-0.25*DDDx1)*delta_t;
caribe_2=-0.125*DDDx2*(exp(-2*delta_t)-1)+0.5*(DDx2+0.5*DDDx2)*delta_t^2+(Dx2-0.25*DDDx2)*delta_t;
caribe_3=-0.125*DDDx3*(exp(-2*delta_t)-1)+0.5*(DDx3+0.5*DDDx3)*delta_t^2+(Dx3-0.25*DDDx3)*delta_t;
x1=x1+caribe_1;
x2=x2+caribe_2;
x3=x3+caribe_3;
q2=x2;
q1=q1+caribe_1;
q3=q3+caribe_3;
elseif (delta_t3==delta_tmin)
delta_t=delta_t3;
t=t+delta_t;
caribe_1=-0.125*DDDx1*(exp(-2*delta_t)-1)+0.5*(DDx1+0.5*DDDx1)*delta_t^2+(Dx1-0.25*DDDx1)*delta_t;
caribe_2=-0.125*DDDx2*(exp(-2*delta_t)-1)+0.5*(DDx2+0.5*DDDx2)*delta_t^2+(Dx2-0.25*DDDx2)*delta_t;
caribe_3=-0.125*DDDx3*(exp(-2*delta_t)-1)+0.5*(DDx3+0.5*DDDx3)*delta_t^2+(Dx3-0.25*DDDx3)*delta_t;
x1=x1+caribe_1;
x2=x2+caribe_2;
x3=x3+caribe_3;
q3=x3;
q1=q1+caribe_1;
q2=q2+caribe_2;
end
n=n+1;
A(n,1)=t;
A(n,2)=x1;
A(n,3)=x2;
A(n,4)=x3;
A(n,5)=m1;
A(n,6)=m2;
end
% A;
figure(2);
plot(A(:,1),A(:,2),'--');hold on
plot(A(:,1),A(:,3),'-.');
plot(A(:,1),A(:,4),'-');
grid on
% plot(A(:,1),A(:,5)*22);hold on
% plot(A(:,1),A(:,6)*22);
legend('room1','room2','wall')
toc
汉武 沈https://www.mathworks.com/matlabcentral/profile/authors/20385258tag:www.mathworks.com,2005:Question/1260782013-10-25T04:00:00Z2021-01-21T09:02:32ZHow do I use MATLAB in English on my Chinese machine?I would like to know if there is a way to get MATLAB in English on my Chinese machine.MathWorks Support Teamhttps://www.mathworks.com/matlabcentral/profile/authors/4622813tag:www.mathworks.com,2005:Question/7044522020-12-29T09:17:24Z2021-01-21T09:01:20ZHow to export the overview table from the Experiment Manager AppI started using the Experiment Manager App to explore a Neural Network performance on a calssification task and how it depends on the hyperparameters of the model.
https://ch.mathworks.com/help/deeplearning/ref/experimentmanager-app.html
The overall design of the App is quite appealing for a first look but the options for exporting the results for further analysis are too limited.
After a hyperparameter sweep the app displays a table of results that displays the accuracy and loss for each trial together with the choosen hyperparameters.
It would be extreemly useful to export this table e.g. to plot validation and test accuracy as function of the hyperparameters to gain more insights. However I could not find such an export option. It is only possible to export the parameters of individual trained Networks. Please let me know if this option exists?
If not, It would be great if such an export option could be added to the app. Or if a function could be provided to extract the results parameters from the results subfolders.
Thanks and Kind Regards
Sebastian LandwehrSebastian Johannes Heinz-Josef Landwehrhttps://www.mathworks.com/matlabcentral/profile/authors/20722347tag:www.mathworks.com,2005:Question/6521382020-11-18T13:39:45Z2021-01-21T09:01:18ZError while using smimportI am receiving an error: 'Error using smimport_implementation' when using the 'smimport' function to import a CAD model into Simscape Multibody. I have copied the command window readout below.
Error using smimport_implementation
Workspace for block diagram 'sm_robot' was not loaded because an error occurred while loading the MATLAB-file 'C:\Program
Files\MATLAB\R2018b\bin\win64\sm_robot_DataFile.m'.
Error in smimport (line 167)
[varargout{1:nargout}] = smimport_implementation(multibodyDescriptionFile, varargin{:});
Caused by:
Error using smimport_implementation
Undefined function or variable 'sm_robot_DataFile'.
I have seen the previous answer to a similar question in 2017, but the issue that caused the error has been fixed in the release I am using: R2018b. The line in the function smimport is also line 167 not 132 as in the older question. This error is even happening with the demo XML file: sm_robot. I have checked that the data file has been generated and I can open it and view it.
How can I rectify this error so that the multibody block diagram builds without errors?Sam Haywardhttps://www.mathworks.com/matlabcentral/profile/authors/16477968tag:www.mathworks.com,2005:Question/1260472014-02-10T05:00:00Z2021-01-21T08:59:15ZWhy doesn't my Student Version Activation Key or Serial Number fit in the Activation Screen?Why doesn't my Student Version Activation Key or Serial Number fit in the Activation Screen? I am not able to activate my software.MathWorks Support Teamhttps://www.mathworks.com/matlabcentral/profile/authors/4622813tag:www.mathworks.com,2005:Question/7219542021-01-20T10:13:16Z2021-01-21T08:58:53ZHow to print ?Plot the following polynomial using linear/linear scale, log/linear scale, linear/log scale and log/log scale.
y=4(x)^2 + 8x +1
Mihir Trivedihttps://www.mathworks.com/matlabcentral/profile/authors/21017016tag:www.mathworks.com,2005:Question/969732009-06-27T01:11:00Z2021-01-21T08:57:19ZHow can I concatenate or merge two structures?I would like to merge two structures into a new structure containing all the fields of the two original structures. How can I do this in MATLAB?
MathWorks Support Teamhttps://www.mathworks.com/matlabcentral/profile/authors/4622813tag:www.mathworks.com,2005:Question/7228282021-01-21T08:51:10Z2021-01-21T08:53:22ZVehicle suspension design problem in simscapehello,
I am trying to design the model of suspension in simsape. the rough drawing of suspension is attached. I tried to develope simscape model for the same and capture the force at the spring but not getting exected results from the model. input is 100mm step input from road. the input replicated the 100mm wheel travel while passing any bump.
Fig.1: actual suspension system rough drawing for reference
Fig.2: Simscape model for the suspension system
Input from input scope:
Output:
Parag Bendrehttps://www.mathworks.com/matlabcentral/profile/authors/15912846tag:www.mathworks.com,2005:Question/7228332021-01-21T08:52:21Z2021-01-21T08:52:21Zhow to change color imagesHi all, i try to fuse between two image.
my coding as below, and my picture as attached.
B = dicomread('TRANSA001_CT025.dcm');
A = dicomread('PETWB001_PT025.dcm');
scale = 512/256
C = imresize(B,scale);
imhowpair(C,B)
My question is, how to change my color for C and B? i want different color for both. so that i easy to see which one is C, and which one is B.
Anyone can help me?
mohd akmal masudhttps://www.mathworks.com/matlabcentral/profile/authors/10957567tag:www.mathworks.com,2005:Question/7227832021-01-21T07:09:17Z2021-01-21T08:50:54ZHow to add tolerance for isequal?Hi,
I am comparing two .mat files, both have very complicated struct type data but they should be almost identical. In this case, I don't found other method except for isequal can perform the comparsion.
data = load('MMC4_cpu_HVDC.mat');
data_ref = load('MMC4_cpu_HVDC_ref.mat');
isequal(data,data_ref)
The code above produced ans = 0. I checked using visdiff, found that it is due to some very small difference in number.
visdiff('MMC4_cpu_HVDC.mat', 'MMC4_cpu_HVDC_ref.mat')
% 13.581349668075767
% ans =
% 13.5813
% 13.581349668075765
% ans =
% 13.5813
I would like to ask if it is possible to add a tolerance factor to isequal? or are there other ways to compare these two .mat files? Example data are attached. Many thanks.
AndyAnd Menghttps://www.mathworks.com/matlabcentral/profile/authors/9534027tag:www.mathworks.com,2005:Question/7193452021-01-17T17:20:39Z2021-01-21T08:50:08ZRun regressions and output the result as a report using "Report Generator"I run regressions such as
fitlm(T.population, T.sales)
I want to output a report that explains
these regression equations and comments
output of fitlm
I looked at "Matlab Report Generator" https://www.mathworks.com/products/matlab-report-generator.html but I do not see an example that helps me get started. Thank you.
alpedhuezhttps://www.mathworks.com/matlabcentral/profile/authors/10930090tag:www.mathworks.com,2005:Question/7225582021-01-20T22:21:09Z2021-01-21T08:49:46ZRaspberry Pi for Matlab/Simulink I2C slave modeHi,
When is I2C slave mode is coming for the official hardware support package for Raspberry Pi?
It is really frustirating to do communications with other MCU's while the "other" MCU is reading all the data in high frequencies from other periphrals, therefore the other MCU is the master in the SDA/SCL line and Raspi needs the data.
Best.Ege Gediksizhttps://www.mathworks.com/matlabcentral/profile/authors/5079835tag:www.mathworks.com,2005:Question/7223142021-01-20T17:29:33Z2021-01-21T08:46:19ZHow to find out a smallest sub-matrix B from a sparse matrix A which has the equal rank and # of non-zero columns?Dear All,
I have a very sparse matrix A. I need to find out a number of rows (smallest #) of A which satisfies the following conditions:
1). Let us suppose the number of rows form a sub-matrix B. In another word, for a given matrix A, we need to find out sub-matrix B;
2). Matrix B must contain the first row of A;
3). The rank of B must be equal to the number of non-zero columns (a non-zero column is defined as a column containing at least one non-zero element in the column) of B.
4). The rank of B must be smaller than the row number of matrix A.
For example,
A = [
1 -1 0 0 0
0 2 0 0 0
0 0 2 -1 -1
1 0 1 0 0
];
The anwser is obvious. The matrix B is formed by the first 2 rows of A:
B = [
1 -1 0 0 0
0 2 0 0 0
];
The condition is satisfied: rank(B) = # of non-zero columns (the first 2 columns are non-zero columns) in B.
How about the following example?
A = [
1 -1 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0
0 0 -1 -1 0 0 0 -1 0
0 0 1 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0
-1 0 0 0 4 -1 -1 -1 0
0 0 0 0 -1 1 0 0 0
0 0 0 0 -1 0 1 0 0
0 0 0 0 -1 0 0 2 0
0 0 0 0 0 0 0 0 0
3 -1 0 0 -1 0 0 0 -1
-1 1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0 1
];
Please help to find out a sub-matrix B for a given sparse matrix A.
Thanks a lot.
BensonBenson Gouhttps://www.mathworks.com/matlabcentral/profile/authors/4652929tag:www.mathworks.com,2005:Question/7220042021-01-20T11:11:11Z2021-01-21T08:44:32ZHow can i count how many time a number appears and for how long in a vector? I have a vector like this
v=[+1 +1 +1 0 0 0 +1 +1 -1 -1 +1 0 0 -1 -1 +1 +1]
I want to count how many times each number appears and for how long. i mean, for example let's consider +1. it appears indivigually only 1 time, then it appears in couple 2 times, then it appear in triplet only 1 time and so on. Could someone help me? thank you!salvatore verginehttps://www.mathworks.com/matlabcentral/profile/authors/17712621tag:www.mathworks.com,2005:Question/1103322013-11-19T05:00:00Z2021-01-21T08:39:16ZWhy is my Network License Manager log file encoded and unreadable?I am trying to review the log file for my Network License Manager, but the file is encoded and unreadable. MathWorks Support Teamhttps://www.mathworks.com/matlabcentral/profile/authors/4622813tag:www.mathworks.com,2005:Question/7217892021-01-20T04:33:57Z2021-01-21T08:39:15ZIMAGE BINARIZE determine THRESHOLD Hi,
i have one set data image grey scale. pixel value from 0 - 1300.
Then i want to threshold is 1300*0.4 = 520 . then the pixel number greater than 520 is 1, the pixel value smaller than 520 is 0.
Then this is my coding,
spect = dicomread ('astitr8sub32.dcm');
MAX = max(max(max(spect)));
T = MAX*0.4;
PVmin = T;
PVmax = MAX;
spect(spect<PVmin)=0;
spect(spect>PVmax)=0;
spect(spect~=0)=1;
spectmax=max(max(max(spect));
spectmin=min(min(min(spect)));
spectrange=spectmax-spectmin;
now i want convert my grey scale to binary image using function adaptthresh,
spect = dicomread ('astitr8sub32.dcm');
MAX = max(max(max(spect)));
T = adaptthresh(spect, 0.4);
BW = imbinarize(spect, T);
spect(spect==BW)=0;
spect(spect==BW)=1;
spectmax=max(max(max(spect)));
spectmin=min(min(min(spect)));
spectrange=spectmax-spectmin;
BUT i GOT ERROR.
CAN SOME ONE HELP ME?mohd akmal masudhttps://www.mathworks.com/matlabcentral/profile/authors/10957567tag:www.mathworks.com,2005:Question/7228232021-01-21T08:38:01Z2021-01-21T08:38:01ZWireless communication between 2 Simulink blocks without Goto/FromHi,
Would there be a way to create 2 Simulink blocks (Matlab Function? S-Function ?) that would be in a same model, at different levels and which could communicate together wirelessly?
I'm looking for a solution that do not use Goto/From blocks. I'm pretty sure there is a code solution, surely complicated, but the outlines of this solution are not clear in my mind.
GLlangrghttps://www.mathworks.com/matlabcentral/profile/authors/14259426tag:www.mathworks.com,2005:Question/7220792021-01-20T12:43:49Z2021-01-21T08:37:38ZGenerate a geographical heat mapHello,
I am trying to generate a heat map on mapping toolbox.
Here I have the coordinates of the centers in my grid:
Lat = 54.2 + 0.1/6 * [11 9 7 5 3 1]' * ones(1,3) ;
Lon = 9.15 + 0.025 * ones(6,1) * [1 3 5] ;
coord = [ [Lat(:,1) , Lon(:,1)] ; [Lat(:,2) , Lon(:,2)] ; [Lat(:,3) , Lon(:,3)] ] ;
So coord is a 18 by 2 matrix, referring to the coordinates of 18 points.
Let us assume I want to assign a random value to each point, then I can define
values = rand(18, 1) .
How can I generate a heat map with such values in such locations?
How can I make each 'pixel' of the heat map like a sqare with size 0.05 by 0.033 degrees in longitude and latitude?
Thank you in advance for your help :)Maurilio Matraciahttps://www.mathworks.com/matlabcentral/profile/authors/15893658tag:www.mathworks.com,2005:Question/7220542021-01-20T12:11:21Z2021-01-21T08:34:42ZUsing Matlab omn others SoftwaresHey,
In my Project I need to control a software (AD5933 REV1.0, from Analog Devices) using Matlab.
Can I do it?
And If I can how is it done?
sincerely,
Aviadaviad mhttps://www.mathworks.com/matlabcentral/profile/authors/8952421tag:www.mathworks.com,2005:Question/1029602013-06-17T20:15:00Z2021-01-21T08:27:14ZWhy am I not able to play videos on the MathWorks website?When I am on the MathWorks web site and I try to play a video, the page loads but the video doesn't play.
MathWorks Support Teamhttps://www.mathworks.com/matlabcentral/profile/authors/4622813tag:www.mathworks.com,2005:Question/1030352012-12-12T17:05:00Z2021-01-21T08:25:48ZHow do I add a hat on a character which is displayed in the LEGEND of a figure in MATLAB 7.0 (R14)?I would like to add a hat on a character in a string which is displayed in the legend of a figure in MATLAB 7.1 (R14SP3).
MathWorks Support Teamhttps://www.mathworks.com/matlabcentral/profile/authors/4622813tag:www.mathworks.com,2005:Question/7186752021-01-16T17:26:32Z2021-01-21T08:19:48Zhow to reset drop down list(go to first option) when pushing any other button in App designerhow can i reset drop down list (go to first option) when pushing any other button in App designer?Hikmet Osmanhttps://www.mathworks.com/matlabcentral/profile/authors/19282290tag:www.mathworks.com,2005:Question/7220942021-01-20T12:50:38Z2021-01-21T08:19:24ZHow to use the state port of an integrator block in Simulink?Hi,
I want to use the state port for initial value of the integrator when it resets. However, I get an error message when I treat it like the output port by adding it with a sumblock to equal-sized state vector, by using a delay block on the signal. The following message occurs regularly:
State ports can only be used to break algebraic loops or to "hand-off" states between systems.
Use the output port rather than the state port of 'untitled/Integrator' as the source of the signal routed (either by direct or virtual connection) to 'untitled/Sample and Hold'
Can someone elaborate on what the state port exactly is? I don't really understand from what I can find about on the internet.David Baashttps://www.mathworks.com/matlabcentral/profile/authors/18471663tag:www.mathworks.com,2005:Question/1269032014-04-23T04:00:00Z2021-01-21T08:17:55ZWhy does MATLAB R2013b, R2014a crash when using Mac OS X?MATLAB R2013b and R2014a have been crashing frequently when used in Mac OS X for various reasons:
a) Sometimes it happens when plugging/unplugging external monitors or displays
b) Sometimes it happens after the computer wakes from or the screen saves goes off.
At times I noticed the crash would not happen right away after any of the above events, but would happen a little after when I would open a new figure, execute code, etc.
The crash produces the following log:
[ 0] 0x000000010715c874 /Applications/MATLAB_R2014a.app/bin/maci64/libmwfl.dylib+00030836 _ZN2fl4diag15stacktrace_base7captureERKNS0_14thread_contextEm+00000052
[ 1] 0x00000001071602aa /Applications/MATLAB_R2014a.app/bin/maci64/libmwfl.dylib+00045738 _ZN2fl4test17terminate_handledEv+00000906
[ 2] 0x000000010715fcf5 /Applications/MATLAB_R2014a.app/bin/maci64/libmwfl.dylib+00044277 _ZN2fl4diag13terminate_logEPKcPK17__darwin_ucontext+00000117
[ 3] 0x0000000106cd8d07 /Applications/MATLAB_R2014a.app/bin/maci64/libmwmcr.dylib+00269575 _Z32mnRunPathDependentInitializationv+00003127
[ 4] 0x0000000106cd8ff8 /Applications/MATLAB_R2014a.app/bin/maci64/libmwmcr.dylib+00270328 _Z32mnRunPathDependentInitializationv+00003880
[ 5] 0x0000000106cd681a /Applications/MATLAB_R2014a.app/bin/maci64/libmwmcr.dylib+00260122 mnFatalSignalHandler+00000298
[ 6] 0x00007fff969615aa /usr/lib/system/libsystem_platform.dylib+00013738 _sigtramp+00000026
[ 7] 0x0000000000000002 <unknown-module>+00000000
[ 8] 0x0000000117a39647 /Applications/MATLAB_R2014a.app/sys/java/jre/maci64/jre/lib/lwawt/liblwawt.dylib+00206407 __Java_sun_lwawt_macosx_CWrapper_00024NSObject_release_block_invoke_1+00000091
[ 9] 0x00000001168715f5 /System/Library/Frameworks/JavaVM.framework/Versions/A/Frameworks/JavaNativeFoundation.framework/Versions/A/JavaNativeFoundation+00026101 +[JNFRunLoop _performCopiedBlock:]+00000020
[ 10] 0x00007fff8d1f213e /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation+00405822 __NSThreadPerformPerform+00000229
Why does this happen?MathWorks Support Teamhttps://www.mathworks.com/matlabcentral/profile/authors/4622813tag:www.mathworks.com,2005:Question/7222342021-01-20T15:54:24Z2021-01-21T08:14:32ZHow do I measure density of random point with a fixed area in MATLAB?There had a 9x9 area and I have generate a lot of point with this area in random.
How do I measure density of the red point (e.g. Bottom left).
Somebody can give something sample code to let me study with this topic? It is very helpful to my project research.
Chun Yin Luihttps://www.mathworks.com/matlabcentral/profile/authors/13915382tag:www.mathworks.com,2005:Question/6265682020-10-26T15:06:30Z2021-01-21T08:12:38ZNot sure of how I can sample this Nyquist wave? Combining data problemsI was given a task of creating a continuous time signal consisting of two different sine waves added together, with this new wave then being sampled after its creation. I managed to complete the first part with ease by making two different sets of data and combining them to make a new sine. Though there came an issue with it, as I could not properl use the stem function to discretely "sample" the data.
This is what I got for my initial output:
https://gyazo.com/f15f83d7f9824ae8cfed10fac1629e93
As you can see, while the wave did end up fine in the end, discrete data was all over the place as you can see with the blue lines not fitting at all into the wave.
This is what I was supposed to get for my output:
https://gyazo.com/52423e5ae12e9b62fcbd88103c4465c4
Over in this image, you can see that the lines fit; the data is being correctly sampled discretely.
This is the code I used to get my intial output
%Time Base
t = 0:0.001:1.8;
%Nyquist Frequencies
Fn1 = 1;
Fn2 = 6;
%Nyquist Rates
Fnr1 = 2*(Fn1);
Fnr2 = 2*(Fn2);
%Sampling Period
Sp1 = 5*(Fnr1);
Sp2 = 5*(Fnr2);
Ts1 = 1/(Sp1);
Ts2 = 1/(Sp2);
T1 = 1/(Fn1);
T2 = 1/(Fn2);
%Number of Samples
N1 = (T1/Ts1);
n1 = 0:1:N1;
N2 = (T2/Ts2);
n2 = 0:1:N2;
nTs1 = n1 * Ts1;
nTs2 = n2 * Ts2;
x_c = sin(2*pi*Fn1*nTs1);
x_c1 = sin(2*pi*Fn1*t);
x_c2 = sin(2*pi*Fn2*nTs2);
x_2 = sin(2*pi*Fn2*t);
signal = x_c1 + x_2;
ct = nTs1 + nTs2;
nqsignal = x_c + x_c2;
%Second Part
h = stem(ct, nqsignal, 'linewidth', 2);
hold
plot(t, signal, 'linewidth', 2)
lgd = legend('Discrete Data', 'Continuous Data');
set (lgd, "fontsize", 12)
set(gca,'XTick',[0:0.2:1.8]);
set(gca,'YTick',[-2:0.5:2]);
title('Time vs Magnitude','fontweight','bold','fontsize',16);
xlabel('Time(s)','fontweight','bold','fontsize',14)
ylabel('Magnitude','fontweight','bold','fontsize',14)
gridJoel Okantahttps://www.mathworks.com/matlabcentral/profile/authors/17349091tag:www.mathworks.com,2005:Question/5748132020-08-04T07:57:20Z2021-01-21T08:08:13ZPlotting a surface from a two-dimensional matrixGood day, I have the following problem:
I've run a simulation that produces some signals depending on two variables. As my advisor told me, I made a python pipeline that saves the simulated signals on a file in a two-dimensional matrix, with the first two columns being the sweeps of the two variables in all the possible permutations. For example. assuming that the two variables have values [1 2 3] and [4 5 6], the first two columns would be:
[1 4]
[1 5]
[1 6]
[2 4]
[2 5]
[2 6]
[3 4]
[3 5]
[3 6]
Now i have to plot these signals on surfaces on a 3d plot. From what I know, to plot a surface one needs the "surf" command, that takes two vectos with dimensions N and M, plus a two-dimensional matrix with dimensions N x M. The only way that i can think of to obtain this in my case would be to build a new data matrix from scratch using a for cycle, to assign the values of the error signals to two-dimensional matrix, but it seems unefficient and lenghty. Am i missing something?Mattia Boldrinihttps://www.mathworks.com/matlabcentral/profile/authors/18629533tag:www.mathworks.com,2005:Question/7221342021-01-20T13:44:02Z2021-01-21T08:06:04ZPlease does anyone know how to import 3D .uv data from LC-UV agilent .D folder?I need to import the .uv file inside the .D folder from agilent LC-UV equipement.
Please, does anyone have an ideia how to do it?Rafael Freirehttps://www.mathworks.com/matlabcentral/profile/authors/2343440tag:www.mathworks.com,2005:Question/1006092009-06-27T01:11:00Z2021-01-21T07:40:45ZWhy does the FPRINTF function round my double precision floating point number in MATLAB 6.5 (R13)?Why does the FPRINTF function round my double precision floating point number in MATLAB 6.5 (R13)?
I am experiencing a formatting problem in MATLAB 6.5 (R13), where only the first 19 significant digits are printed correctly to a text file when I use the FPRINTF function. The script below shows that the data is stored internally with the correct precision, but not when it is printed to a text file.
fid = fopen('out.txt','w+');
a = -0.00283527374267578125;
fprintf(fid, '%.25f\n', a);
fprintf('%.25f\n', a*2);
fclose(fid);
The result of printing "a" to a file:
-0.0028352737426757813000000
-0.0056705474853515625000000
The number should be exactly representable in floating point format, since it is only a 20 bit binary number:
Decimal Form:
a = -0.00283527374267578125;
Hexidecimal Form (format hex):
a = bf673a0000000000;
I am inclined to think the problem is concerned with how MATLAB converts the floating point number to a decimal when using the FPRINTF function.MathWorks Support Teamhttps://www.mathworks.com/matlabcentral/profile/authors/4622813tag:www.mathworks.com,2005:Question/4589002019-04-27T18:27:17Z2021-01-21T07:39:39ZMultiple Input Single Output Segmentation using Deep LearningI have 4 modal volumetric image data and output segemented data. I have to create a multi input DAG network, and I have succesfully created it using lgraph..
But I cannot able to train the network using trainNetwork. It shows error that only one input can be feed to trainNetwork..
My code is below, store1, store2, store3, store4 are four input 3d datastore and pxd is the output datastore
inputSize = [64 64 64];
layers1 = [
image3dInputLayer(inputSize,'Normalization','none','Name','input1')
convolution3dLayer(3,155,'Padding','same','Name','conv_11')
maxPooling3dLayer(4,'Name','maxpool1')];
layers2=[
image3dInputLayer(inputSize,'Normalization','none','Name','input2')
convolution3dLayer(3,155,'Padding','same','Name','conv_21')
maxPooling3dLayer(4,'Name','maxpool2')];
layers3=[
image3dInputLayer(inputSize,'Normalization','none','Name','input3')
convolution3dLayer(3,155,'Padding','same','Name','conv_31')
maxPooling3dLayer(4,'Name','maxpool3')];
layers4=[
image3dInputLayer(inputSize,'Normalization','none','Name','input4')
convolution3dLayer(3,155,'Padding','same','Name','conv_41')
maxPooling3dLayer(4,'Name','maxpool4')];
concat1=concatenationLayer(3,4,'Name','depth_1');
outlayer=[
transposedConv3dLayer(3,620,'stride',2,'cropping','same','Name','tconv_o1')
convolution3dLayer(1,numLabels,'Name','convLast');
softmaxLayer('Name','softmax');
dicePixelClassification3dLayer('output')];
lgraph = layerGraph;
lgraph = addLayers(lgraph,layers1);
lgraph = addLayers(lgraph,layers2);
lgraph = addLayers(lgraph,layers3);
lgraph = addLayers(lgraph,layers4);
lgraph = addLayers(lgraph,concat1);
lgraph = addLayers(lgraph,outlayer);
lgraph = connectLayers(lgraph,'maxpool1','depth_1/in1');
lgraph = connectLayers(lgraph,'maxpool2','depth_1/in2');
lgraph = connectLayers(lgraph,'maxpool3','depth_1/in3');
lgraph = connectLayers(lgraph,'maxpool4','depth_1/in4');
lgraph = connectLayers(lgraph,'depth_1','tconv_o1');
plot(lgraph)
miniBatchSize = 1;
options = trainingOptions('rmsprop', ...
'MaxEpochs',1, ...
'InitialLearnRate',0.01, ...
'LearnRateSchedule','piecewise', ...
'LearnRateDropPeriod',5, ...
'LearnRateDropFactor',0.95, ...
'Plots','training-progress', ...
'Verbose',false, ...
'MiniBatchSize',miniBatchSize);
[net,info] = trainNetwork({store1,store2,store3,store4},pxds,lgraph,options);
Error shown is
Error in line:
[net,info] = trainNetwork({store1,store2,store3,store4},pxds,lgraph,options);
Caused by:
Network: Too many input layers. The network must have one input layer.
Detected input layers:
layer 'input1'
layer 'input2'
layer 'input3'
layer 'input4'
Please help me to solve this problem or suggest another way to train multi input image dataKoshyhttps://www.mathworks.com/matlabcentral/profile/authors/3928210tag:www.mathworks.com,2005:Question/7227432021-01-21T06:18:07Z2021-01-21T07:39:26ZExporting data from .h5 file to matlabI am having troubles to export a file from a .h5 file format to matlab, the code runs successfully but matlab plot/ figure does not show up. Does anyone know what is the issue with the code? Thanks.
clear vars; close all; clc; format compact;
filename = "data.h5";
info = h5info(filename);
disp("Keys =")
for i = 1:size(info.Datasets)
name = info.Datasets(i).Name;
fprintf(" %s\n", name);
end
mode = string(h5read(filename, "/mode"))
sensor_config = jsondecode(string(h5read(filename, "/sensor_config_dump")))
session_info = jsondecode(string(h5read(filename, "/session_info")))
data = h5read(filename, "/data");
disp("Data size =")
disp(size(data))
% Dimensions (frame, sensor, depth) for Envelope, IQ, Power bins
% (frame, sensor, sweep, depth) for Sparse
if ndims(data) == 3 % Not sparse
range_start = sensor_config.range_interval(1);
range_end = sensor_config.range_interval(2);
depths = linspace(range_start, range_end, size(data, 3));
frames = 1:size(data, 1);
data_from_first_sensor = squeeze(data(:, 1, :));
plot_data = abs(data_from_first_sensor);
imagesc(frames, depths, plot_data).show()
xlabel("Sweeps")
ylabel("Depth")
end
data_info = jsondecode(string(h5read(filename, "/data_info")));
first_data_info = data_info(1, 1) % (frame, sensor)
rss_version = string(h5read(filename, "/rss_version"))
lib_version = string(h5read(filename, "/lib_version"))
timestamp = string(h5read(filename, "/timestamp"))Chloe Lohhttps://www.mathworks.com/matlabcentral/profile/authors/19184076tag:www.mathworks.com,2005:Question/7226832021-01-21T03:29:07Z2021-01-21T07:38:13ZIs there anyway to calculate the position in coordinates of points using a n*n distance matrix?if there are n points in a 2-D coordinate, it is relatively easy to calculate the distance matrix using their positions. However, can we calculate the position of n points using a n*n distance matrix? And, will there be more than one solution? Results with the same "shape" should be viewed as one solution.
Say, if there are only 3 points and a 3*3 distance matrix, it is very easy to obtain a triangle with only one possible shape. But if n > 3, will it also stand?Meme Younghttps://www.mathworks.com/matlabcentral/profile/authors/12013418tag:www.mathworks.com,2005:Question/7183102021-01-16T02:53:30Z2021-01-21T07:37:06ZMatlab license expiration, now?Now I get this message when I open Matlab:
----------------------------------------------------
Your MATLAB license will expire in 14 days.
Please contact your system administrator or
MathWorks to renew this license.
----------------------------------------------------
Bobby Fischerhttps://www.mathworks.com/matlabcentral/profile/authors/17553780tag:www.mathworks.com,2005:Question/4201552018-09-21T14:37:39Z2021-01-21T07:36:44Zhow to use coolpropIn following the instructions on:
http://www.coolprop.org/coolprop/wrappers/MATLAB/index.html#matlab
and executing:
>> CoolProp.PropsSI('T','P',101325,'Q',0,'Water')
produces the following errors:
Warning: function AbstractState_d4alphar_dDelta3_dTau takes at most 1 arguments
> In CoolProp.PropsSI (line 2)
Error using CoolPropMATLAB_wrap
Fatal error.
Error in CoolProp.PropsSI (line 2)
[varargout{1:max(1,nargout)}] = CoolPropMATLAB_wrap(345,varargin{:});
I have not found literature on error codes.
I would appreciate any help in identifying how to start this up, general use instructions, and trouble shooting actions.Ray Josephhttps://www.mathworks.com/matlabcentral/profile/authors/13263262tag:www.mathworks.com,2005:Question/7227982021-01-21T07:29:46Z2021-01-21T07:29:46ZProblem with Matlab when calling COM/ActiveXHi everyone,
Does anyone here could help me with this problem. These codes below were written in different languages and they pass nine arguments to the function:
(Visual Basic .NET}
Dim boolstatus As Boolean = false
boolstatus = swModelExtension.SelectByID2("Point1", "SKETCHPPOINT", .2, .3, 0, False, 0, Nothing, swSelectOptionDefault)
(Visual Basic for Applications (VBA))
Dim Result as Boolean
Result = swModelExtension.SelectByID2("Point1", "SKETCHPOINT", .2, .3, 0, False, 0, Nothing, swSelectOptionDefault)
(C#)
bool boolstatus = false;
boolstatus = swModelExtension.SelectByID2("Point1", "SKETCHPOINT", .2, .3, 0, false, 0, null, swSelectOptionDefault);
(Unmanaged C++ COM)
VARIANT_BOOL Result = FALSE;
HRESULT hres = swModelExtension->SelectByID2(_T("Point1"),_T("SKETCHPOINT"),.2,.3, 0,0,0,0,swSelectOptionDefault,&result);
My problem is that I want to convert it to Matlab using COM/ActiveX method. I have tried with matlab code as below, however it DID NOT' work:
mystatus=invoke(swModelExtension,'SelectByID2','Point1','SKETCHPOINT','.2','.3','0','0','0','0','swSelectOptionDefault');
Please help me to solve this problem. Thank you in advance.
Son Trinh-Vanhttps://www.mathworks.com/matlabcentral/profile/authors/21012422tag:www.mathworks.com,2005:Question/7222442021-01-20T15:58:52Z2021-01-21T07:29:25ZHow to write name inside polygon?After create a polygon how to write name inside it so you can differeniate between it and the other polygons?ZeKkEn NoNamehttps://www.mathworks.com/matlabcentral/profile/authors/20819963tag:www.mathworks.com,2005:Question/7227932021-01-21T07:28:17Z2021-01-21T07:28:17ZGood day everyone, do anyone knows the commands to plot these 2 equations in a graph? 1st function blue colour and 2nd in red... and I'm using R2020b.Jashveendas N. Kannadhashttps://www.mathworks.com/matlabcentral/profile/authors/20434200