https://jp.mathworks.com/matlabcentral/answers/questions.atomMATLAB Answers — 新規の質問2019-02-18T08:59:13Ztag:jp.mathworks.com,2005:Question/4455152019-02-18T06:54:14Z2019-02-18T08:59:13Zcould anyone help me how to change the number of clusters for every iterationI am having an array of data set A=[1 2;
3 4;
5 6;
7 8;
9 10;
11 12]
I want to group A into different number of clusters under the condition the number of clusters should not be more than size(A,1)
I need to run for several iterations.
For every iteration the number of clusters needs to be changed.
jaah navihttps://jp.mathworks.com/matlabcentral/profile/authors/11695462-jaah-navitag:jp.mathworks.com,2005:Question/2652522016-01-26T11:00:59Z2019-02-18T08:57:42ZI have to digitize this image(Contour Map) for Grid of 0.1x0.1 .Xvalue(123,131)
Yvalue(33,43)
<</matlabcentral/answers/uploaded_files/44076/500.JPG>>
E R SH RAJ Malehttps://jp.mathworks.com/matlabcentral/profile/authors/7037801-e-r-sh-raj-maletag:jp.mathworks.com,2005:Question/4454902019-02-18T02:33:18Z2019-02-18T08:57:00ZHow to remove this error, I get it in all my programme?Error using gradient (line 49)
Too many output arguments.
Error in feature (line 21)
[gx gy]=gradient(G);
Error in images.internal.isFigureAvailable (line 9)
if feature('showFigureWindows')
Error in imshow (line 207)
if ~images.internal.isFigureAvailable()
Error in Untitle (line 2)
imshow(A);
please, Help me as soon as possible.riddhi thakkarhttps://jp.mathworks.com/matlabcentral/profile/authors/13146611-riddhi-thakkartag:jp.mathworks.com,2005:Question/4455162019-02-18T07:02:53Z2019-02-18T08:56:39ZMINIMIZE symbolic function PX(t) = sym('x',[6 2])
syms t
syms X(t) t t0 tf N
a = diff(X(t),t)
b=a'
f=b*a
int( f,t, t0,tf)
P = symsum(f,t,0,N)
I need to minimize this symbolic (matrix) function P
Constraints:-
1.) P ∈ {0,1}
2.)P'*P=eye(M)
3.) t ∈ [t0, tf ]
4.) N=6Vanshika Singhhttps://jp.mathworks.com/matlabcentral/profile/authors/13217944-vanshika-singhtag:jp.mathworks.com,2005:Question/4455292019-02-18T08:54:03Z2019-02-18T08:54:03ZSlider Code GUI problem
What is the code for the slider to move along the x axis on zooming or to move anytime ?
% --- Executes on slider movement.
function slider2_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function slider2_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
Any one can help with the code ?Hassan Boshahttps://jp.mathworks.com/matlabcentral/profile/authors/14798685-hassan-boshatag:jp.mathworks.com,2005:Question/4449542019-02-14T12:11:56Z2019-02-18T08:51:29ZHow to apply external heat flux to a surface with specified "emissivity" boundary conditions in MATLAB R2018 PDE Toolbox?I am modelling thermal behaviour of lunar surface, thus it is necessary to specify both heat flux from incident solar radiation and thermal radiation of the lunar surface.
Unfortunately, one of these is ignored, when declared as follows:
thermalBC(thermalmodelT,'Edge',2,'HeatFlux',@SolRad_hf);
thermalmodelT.StefanBoltzmannConstant = 5.670373E-8;
thermalBC(thermalmodelT,'edge',2,'Emissivity',0.98,'AmbientTemperature',3); Grzegorzhttps://jp.mathworks.com/matlabcentral/profile/authors/2211624-grzegorztag:jp.mathworks.com,2005:Question/4434652019-02-06T08:50:48Z2019-02-18T08:50:28ZFeature Request: Simulink Dashboard CustomizationHi,
I found there were a few posts requesting the interface to customize the Simulink dashboard element. I hope to bring it up again. I am working on a project for a customer but I find the dashboard library is powerful yet limited. For example, I do not have a vertical indicator for intuitive level reading. Also, I would like to display the water tank sectional view to directly show the user how much water in the tank. However, the only thing I can use is MultiStateImage that I have to use by creating a lot of images representing different levels.
I have seen simulink adding the real time pacer as the built in module, Simulink is becoming increasingly suitable for real-time operation and off line simulation. Hopefully we can see the fully customizable dashboard library soon.yuanyi wuhttps://jp.mathworks.com/matlabcentral/profile/authors/8526580-yuanyi-wutag:jp.mathworks.com,2005:Question/4455272019-02-18T08:36:28Z2019-02-18T08:47:05ZDetect all the rectangles in imageHey all,
in the following image, all the rectangles are a little bit deformed due to power leakage effect. I want to detect all the rectangles and obtain the positions of the rectangles.
Is there a way to detect all rectangles?
Thank yousimon xuhttps://jp.mathworks.com/matlabcentral/profile/authors/14242564-simon-xutag:jp.mathworks.com,2005:Question/809662013-07-03T07:18:36Z2019-02-18T08:45:22ZHow to save Simulink model as picture?I have a simulink model. i want to save that model into different picture formats like .jpeg, .tif etc.. Is it possible?Harish Balagahttps://jp.mathworks.com/matlabcentral/profile/authors/2657630-harish-balagatag:jp.mathworks.com,2005:Question/4304432018-11-17T15:07:47Z2019-02-18T08:44:21ZI was facing problem in activation matlab 2017a. I enter the path of license for activation and it gets complete but when i start matlab it again demands activation.Now I have change the calender date of my laptop i.e., 2016. Matlab is running now but the problem is that by changing date to previous year I can't use google. This means I can't use matlab and internet at the same time.Tell me how to cope with this problem?Sajid Sarwarhttps://jp.mathworks.com/matlabcentral/profile/authors/11672676-sajid-sarwartag:jp.mathworks.com,2005:Question/4455282019-02-18T08:41:44Z2019-02-18T08:41:44ZHow to hide and reappear titles of plot in matlab gui axes using visible?i have different panels with axes and titles to each of these plots. I want to hide and later reappear the plot title based on the user requirement
I tried the following:
handles.figure1.CurrentAxes.Title.Visible = 'off';
This hides the title only for the last axes from the last panel, not all.
I also tried
delete(findall(findall(gcf,'Type','axe'),'Type','text'))
but this deletes all the titles instead of hiding them.
Please help me with this!
Thank you in advanceTejaswini Rameshhttps://jp.mathworks.com/matlabcentral/profile/authors/4116904-tejaswini-rameshtag:jp.mathworks.com,2005:Question/1594972014-10-21T11:51:27Z2019-02-18T08:36:28Zclear titles in guihow can i clear the title in the gui....
i used
cla('reset')
but it clears only the last axes title? how to clear all titles....Elysi Cochinhttps://jp.mathworks.com/matlabcentral/profile/authors/3625227-elysi-cochintag:jp.mathworks.com,2005:Question/4451772019-02-15T15:23:45Z2019-02-18T08:36:27ZError writing name_file.m. Access denied.Hi everyone, I have a sudden problem when I try to save or run the file. The error window say "Error writing name_file.m. Access denied". It's really strange because it has always worked well. I tryed to:
Change path location
Open Matlab as administrator
Change Matlab version from 2016 to 2018
Change Matlab file
But i have always the same problem. I can not understand what the problem could be. This is the screenshot:
michele paolettihttps://jp.mathworks.com/matlabcentral/profile/authors/9117418-michele-paolettitag:jp.mathworks.com,2005:Question/4454922019-02-18T03:05:14Z2019-02-18T08:31:55ZHow obtain the Y value that corresponds to the largest X value for a number of plots?Hi,
I am trying to write a code that gives me the Y value that corresponds to the largest X value for a number of plots.
I have a code that interpolates X values from Y. I just need the oposite and for the largest X values instead.
clear; clc;
Folder = cd;
N=170;
x2 = zeros(N, 10);
for k = 1:N;
Driftt = sprintf('Disp%d.out', k);
Reactt = sprintf('React%d.out', k);
matDrift = importdata(fullfile(Folder, Driftt));
matReact = importdata(fullfile(Folder, Reactt));
x1= matDrift(:,1);
y1= matDrift(:,2);
[x3, ix] = unique(x1);
y3 = y1(ix);
A=dlmread('Time.txt');
for i=1:size(A,2)
x2 (k,:) = interp1(y3, x3, A(:,i), 'linear');
temp=x2(k,:);
temp(isnan(temp))=0.05;
x2(k,:)=temp;
fid=fopen(['result_' num2str(i) '.txt'],'a');
fprintf(fid,'%f\n',x2(k,:));
fclose(fid);
end Ismail Qeshtahttps://jp.mathworks.com/matlabcentral/profile/authors/10292327-ismail-qeshtatag:jp.mathworks.com,2005:Question/4455202019-02-18T08:01:51Z2019-02-18T08:31:20ZODE solver - L'Hospital RuleHello,
I'm using MATLAB ODE suite to solve a couple of ODEs. I watched the webinar (https://www.mathworks.com/videos/series/solving-odes-in-matlab-117658.html) and it was really helpful!
I have some instances where the integrand becomes 0/0 (e.g. dy/dt = A*sin(t) / B*sin(y) where y=0 at t=0 and y=2pi at t=2pi).
Does any of the MATLAB ODE solver implement the L'Hospital rule for such cases? If not, what would be the best way to implement this (with ODE45 or ODE15S for example)?
Vigneshhttps://jp.mathworks.com/matlabcentral/profile/authors/3125021-vigneshtag:jp.mathworks.com,2005:Question/938212013-07-12T02:51:38Z2019-02-18T08:29:12Z評価版の MathWorks 製品は利用できますか？評価版をダウンロードして、MathWorks 製品を利用したい。
MathWorks Support Teamhttps://jp.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:jp.mathworks.com,2005:Question/4455192019-02-18T07:37:13Z2019-02-18T08:25:04ZMigration between MatLab Version: Usage of linprog and fminconHi there!
My collegue (Petros) and myself are working on a Project to replace and old Solution using MatLab R2010b with a new Solution using MatLab R2018a.
Having said that, we face some issue as there are some changes between the two MatLab versions in the functions fmincon and linprog that we are using.
Initially, we had quite large differences. This was mainly due to differences in fmincon itslef. We called fmincon with the following options:
We then compare the two fmincon.m files in R2010b and R2018a and figured out, that there have been significant changes - specially around the options. By adding all Options for which the default has changed, and that we did not include in our call to the R2010b values, we got much closer:
Please not: The true default for Algorithm in R2010b is trust-region-reflective, but by inspecting fmincon.m, in line 490, when is not empty, fmincon.m changes the algorithm to active-set.
With that, we are now much closer to the Results in R2010b. But not yet there.
Are there any other options that we need to change in order ot get the same results with fmincon between the two versions?
Having said that, we are also useing a function called linprog in our tool. This one also changes in the options. We are calling it three times with different options:
Resulting in the following call in linprog.m line 265 in R2010b (if I'm not mistaken):
Resulting in the following call in linprog.m line 297 in R2010b (if I'm not mistaken):
Resulting in the following call in linprog.m line 256 in R2010b (if I'm not mistaken):
In R2018a, I see, that the Simplex option is no longer available.
However, we have a number of new options:
Algorithm with default dual-simplex
MaxTime with default Inf
Preprocess with default basic
TolCon with default []
In the old linprog.m file, I find different algorithm being used internally around line 221:
In R2018a, I find:
I do not find simplex anymore nore active-set. Also for interior-point, I have two version. I do also not find anything useing simplex or qpsub in the R2018a linprog.m file. How do we need to call linprog in R2018a to get same results like in R2010b?
Also, could you help us with an a bit more detailed description on what the different algorithms in the two functions (fmincon and linprog) in R2018a are supposed to do?
Thanks a lot
StefanPetros Almpanopouloshttps://jp.mathworks.com/matlabcentral/profile/authors/8462763-petros-almpanopoulostag:jp.mathworks.com,2005:Question/4455262019-02-18T08:21:30Z2019-02-18T08:21:30ZHow to decode wma audio file into image using matlab?Hi,
I have received NOAA satellite signal in the wma format. I need to decode wma audio file into weather image. I have decoded using readily available decoder softwares but I need to know how I can decode using matlab? Can anyone help me with this?KANNAN SELVANhttps://jp.mathworks.com/matlabcentral/profile/authors/9926126-kannan-selvantag:jp.mathworks.com,2005:Question/4455252019-02-18T08:21:05Z2019-02-18T08:21:05ZLicense reinstate fee should be more flexible.Hi,
I’m a researcher working on a non-profit organization for over 20 years. Also, I have been renewing license for a copy of MATLAB including Simulink and other toolboxes.
As we are controlled by R&D policy and laws of my country, the maintenance period should be within duration of every fiscal year.
Also, any purchase order cannot be made unless account is activated after budget is income.
My project account closes in 31 December, and reopens end of January or February next year because of evaluation and contract process of the project.
I tried to renew my license on Feb. 1 once account was opened, and I was informed that additional 25% penalty for 12 month maintenance fee was added for re-install license.
I feel this is too severe punishment for just one month delay for inevitable situation. And I concern this will happen next year again.
I hope Mathworks treats loyal customers fairly.
Seung-Kook Ro
Seung-Kook Rohttps://jp.mathworks.com/matlabcentral/profile/authors/268450-seung-kook-rotag:jp.mathworks.com,2005:Question/4455232019-02-18T08:14:09Z2019-02-18T08:14:49ZCurrent density for conductive media DC problem (2d)I've solved a multi-domain 2D conductive media DC problem for the potential u. I can plot the electric field E ... it's the gradient of the potential. Now I want to plot the current density, J. This is sigma*E where sigma is the conductivity in a region. But I can't figure out how to access what region a point (x,y) is in. Its clearly possible because the solver can do it, but the solver's methods are private.
How do I find the region that a specified point (x,y) is in? Or, is there a function that will plot J (vector field) directly from the solved model?
Thanks.Mikehttps://jp.mathworks.com/matlabcentral/profile/authors/102428-miketag:jp.mathworks.com,2005:Question/4455222019-02-18T08:10:22Z2019-02-18T08:14:00ZHelp with the plot!Jatt Jeephttps://jp.mathworks.com/matlabcentral/profile/authors/14774554-jatt-jeeptag:jp.mathworks.com,2005:Question/4455212019-02-18T08:06:01Z2019-02-18T08:06:01ZAzimuth data: Colormap wrapping when performing interpolationHello,
I have a problem with interpolating a colormap for azimuth / circular data... Please check the attached images: The colormap (HSV) represents the direction of the vectors (ranging from -180 to +180 degrees). Red is left, cyan ist right, greenish is up and purple is down.
For several reasons, I would like to create a smooothed graphical output. That is why I upscale the dataset using the function 'imresize'.
But the result gives a strong line when the direction changes from -180 to +180 (for reasons that I understand, but I can't think of a workaround...).
Does someone have an idea how to prevent this colormap wrapping...? Thanks!!
William Thielickehttps://jp.mathworks.com/matlabcentral/profile/authors/1377529-william-thielicketag:jp.mathworks.com,2005:Question/4455172019-02-18T07:22:23Z2019-02-18T08:03:39Zcomparing and updating fields in a structurei have this part of code where i want to do a comparison for a loop of (i) to compare the name SSID then if it is write it have to update the RSSI field
([wifiScanDataStruct.UserData.Dev(i).SSID num2str(wifiScanDataStruct.UserData.Dev(i).RSSI)]) %% the stated structure without updating
([tmp.SSID(1) num2str(tmp.RSSI(1))]) %% the recived valuesHamda Altamimihttps://jp.mathworks.com/matlabcentral/profile/authors/5930055-hamda-altamimitag:jp.mathworks.com,2005:Question/3813042018-02-07T13:32:33Z2019-02-18T07:58:36ZHow to display the value of an enumeration in a table, as opposed to a 1x1 array of the enumeration class?See the attached image. In my table, I have a series of asset types. Ideally, my table would display 'cash' or 'bond' instead of 1x1 Asset Type...
Is this possible?Simon Partenhttps://jp.mathworks.com/matlabcentral/profile/authors/6843956-simon-partentag:jp.mathworks.com,2005:Question/4447942019-02-13T16:34:37Z2019-02-18T07:48:04ZHow to extrapolate to the point of intersection i have the following data :
x=[5 6 7 8 9 10 11 12 13 14 15 16 16.5 17 17.5 18 18.5 19 19.5 20 20.5 21 21.5 22 23 24 25 26 27 28 29 30]
y=[110.515 148.485 139.68 218.925 352.41 441.755 490.11 518.295 521.32 515.825 499.51 499.345 471.685 666.715 1100.35 936.625 484.64 568.875 1444.015 1859.38 1478.71 383.84 352.75 324 282.6 239.2 215.5 189.1 165.95 142.8 137.85 128.7]
i would like to find the x value for the intersection point with the x axis (y=0)
using extrapolation by an approximate function and how i show the equation of that function
zerguine nafissahttps://jp.mathworks.com/matlabcentral/profile/authors/14771535-zerguine-nafissatag:jp.mathworks.com,2005:Question/4455182019-02-18T07:32:14Z2019-02-18T07:32:14ZPlotting a graph for time and distance where i have contant velocityI am trying to plot a graph i have distance between two point that is coverd via two different path due to which i have different time to complete the path i want to show comparision of both with respect of time how shoulsd i write the code?muhammad ahmadhttps://jp.mathworks.com/matlabcentral/profile/authors/11234519-muhammad-ahmadtag:jp.mathworks.com,2005:Question/2443042015-09-21T16:40:27Z2019-02-18T07:30:57ZGenerate random 3D coordinates in a cylinderI want to generate a set of 1000 3D points (x,y,z) which are located inside a cylinder of radius r and centre axis from [x1,y1,z1] to [x2,y2,z2].
Any ideas?
Lucyhttps://jp.mathworks.com/matlabcentral/profile/authors/3740138-lucytag:jp.mathworks.com,2005:Question/4451582019-02-15T13:32:38Z2019-02-18T07:30:16ZSolving Multiple First Order Differential Equations for Constants
Hi,
I hope someone can help me.
I am looking to solve these 6 first order differential equations for the unknowns k1, k2, k3, k4, k5 and k6, with known concentrations in the square brackets (any number for them will do just now to get a working script!). Could someone help me obtain a script to do this?
Many thanks in advance. HKhttps://jp.mathworks.com/matlabcentral/profile/authors/14793061-hktag:jp.mathworks.com,2005:Question/4452082019-02-15T18:49:17Z2019-02-18T07:12:57ZError massage "failed to generate binary outputs"I have made a model for a flasher in Simulink, but when I pressed the button ''deploy to hardware'' to generate the code for the arduino Uno, I constantly get the error massage: "failed to generate all binary outputs''. I have already tried to restard the arduino, redownloading the arduino support package for simulink and changing the location of the simulation cache and code generation folder to another folder in "documents". I also haven't used any spaces in the file name.
You can find the full diagnostics here:
### Generating code into build folder: D:\persoonlijke map Davide\Documenten\MATLAB\Practicum_1_ert_rtw
### Invoking Target Language Compiler on Practicum_1.rtw
### Using System Target File: C:\Program Files\MATLAB\R2018a\rtw\c\ert\ert.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
.
### Caching model source code
### Writing header file Practicum_1_types.h
### Writing header file Practicum_1.h
### Writing source file Practicum_1.c
### Writing header file rtwtypes.h
### Writing header file multiword_types.h
### Writing header file Practicum_1_private.h
### Writing header file rtmodel.h
.
### Writing source file Practicum_1_data.c
### Writing source file ert_main.c
### TLC code generation complete.
### Evaluating PostCodeGenCommand specified in the model
### Using toolchain: Arduino AVR v1.8.1 | gmake (64-bit Windows)
### 'D:\persoonlijke map Davide\Documenten\MATLAB\Practicum_1_ert_rtw\Practicum_1.mk' is up to date
### Building 'Practicum_1': "C:\PROGRA~1\MATLAB\R2018a\bin\win64\gmake" -f Practicum_1.mk all
D:\persoonlijke map Davide\Documenten\MATLAB\Practicum_1_ert_rtw>cd .
D:\persoonlijke map Davide\Documenten\MATLAB\Practicum_1_ert_rtw>if "" == "" ("C:\PROGRA~1\MATLAB\R2018a\bin\win64\gmake" -f Practicum_1.mk all ) else ("C:\PROGRA~1\MATLAB\R2018a\bin\win64\gmake" -f Practicum_1.mk )
C:/ProgramData/MATLAB/SupportPackages/R2018a/3P.instrset/arduinoide.instrset/arduino-1.8.1/hardware/tools/avr/bin/avr-g++ -std=gnu++11 -fpermissive -fno-exceptions -fno-threadsafe-statics -c -g -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10801 -MMD -MP -MF"MW_digitalio.dep" -MT"MW_digitalio.o" -Os -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -DMODEL=Practicum_1 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DMW_TIMERID=1 -DMW_PRESCALAR=256 -DMW_TIMERCOUNT=59286 -DMW_SCHEDULERCOUNTER=1 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_ANALOG_REF_=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DTID01EQ=0 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=Practicum_1 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -ID:/persoonlijke map Davide/Documenten/MATLAB -IC:/ProgramData/MATLAB/SupportPackages/R2018a/toolbox/target/supportpackages/arduinobase/include -ID:/persoonlijke map Davide/Documenten/MATLAB/Practicum_1_ert_rtw -ID:/persoonlijke map Davide/Documenten/Practica -IC:/PROGRA~1/MATLAB/R2018a/extern/include -IC:/PROGRA~1/MATLAB/R2018a/simulink/include -IC:/PROGRA~1/MATLAB/R2018a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2018a/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2018a/rtw/c/ert -IC:/ProgramData/MATLAB/SupportPackages/R2018a/3P.instrset/arduinoide.instrset/arduino-1.8.1/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2018a/3P.instrset/arduinoide.instrset/arduino-1.8.1/hardware/arduino/avr/variants/standard -IC:/ProgramData/MATLAB/SupportPackages/R2018a/3P.instrset/arduinoide.instrset/arduino-1.8.1/libraries/Servo/src -IC:/ProgramData/MATLAB/SupportPackages/R2018a/toolbox/target/supportpackages/arduinotarget/include -IC:/ProgramData/MATLAB/SupportPackages/R2018a/toolbox/target/supportpackages/arduinotarget/scheduler/include -IC:/ProgramData/MATLAB/SupportPackages/R2018a/3P.instrset/arduinoide.instrset/arduino-1.8.1/hardware/tools/avr/avr/include/avr -IC:/ProgramData/MATLAB/SupportPackages/R2018a/toolbox/target/shared/externalmode_daemon/include -o MW_digitalio.o C:/ProgramData/MATLAB/SupportPackages/R2018a/toolbox/target/supportpackages/arduinobase/src/MW_digitalio.cpp
avr-g++: error: map: No such file or directory
avr-g++: error: Davide/Documenten/MATLAB: No such file or directory
avr-g++: error: map: No such file or directory
avr-g++: error: Davide/Documenten/MATLAB/Practicum_1_ert_rtw: No such file or directory
avr-g++: error: map: No such file or directory
avr-g++: error: Davide/Documenten/Practica: No such file or directory
gmake: *** [MW_digitalio.o] Error 1
D:\persoonlijke map Davide\Documenten\MATLAB\Practicum_1_ert_rtw>echo The make command returned an error of 2
The make command returned an error of 2
D:\persoonlijke map Davide\Documenten\MATLAB\Practicum_1_ert_rtw>An_error_occurred_during_the_call_to_make
'An_error_occurred_during_the_call_to_make' is not recognized as an internal or external command,
operable program or batch file.
### Creating HTML report file Practicum_1_codegen_rpt.html
(36): warning: generic lexer warning: Unterminated 'C++' style comment
### Build procedure for model: 'Practicum_1' aborted due to an error.
Error(s) encountered while building "Practicum_1":
### Failed to generate all binary outputs.Davide Carishttps://jp.mathworks.com/matlabcentral/profile/authors/14652112-davide-caristag:jp.mathworks.com,2005:Question/4451412019-02-15T11:29:12Z2019-02-18T07:09:14Zhow to use genetic algorithm for EEG channel selection of motor imagery signal?usage of genetic algorithm for selection of EEG channels such that it helps in identification of motor imagery EEG signal channel ( example C3, C4 ) like that.arunnagiri murrugesanhttps://jp.mathworks.com/matlabcentral/profile/authors/5535768-arunnagiri-murrugesantag:jp.mathworks.com,2005:Question/4455122019-02-18T06:07:19Z2019-02-18T07:00:31Zindexing an entire for loopHi all. Embarassed to be asking for homework help, but I can't figure out this for loop.
Essentially, I need each iteration of the inner function to save to the matrix T. The size of the matrix remains correct (61x21), but it only saves the last iteration to the matrix. I have tried the i = i+1 indexing method but my matrix blows up to 1281x21 with each column running thru both the inner and outer loops.
clear;
x = -3:0.1:3;
y = -1:0.1:1;
i = length(x);
j = length(y);
T = zeros(i,j);
for x = -3:0.1:3
for y = -1:0.1:1
T(i,j) = x^2+(2*y^2);
end
endMatthew Henryhttps://jp.mathworks.com/matlabcentral/profile/authors/14523633-matthew-henrytag:jp.mathworks.com,2005:Question/4454932019-02-18T03:31:03Z2019-02-18T06:59:43Z3D point CloudI am trying to get a 3D point cloud from live video using 2 usb webcms but as I run the code two axis shows up and the following error shows up:
ERROR:
Error using imaq.internal.VideoDeviceInternal (line 344)
winvideo: The device associated with device ID 2 is already in use. A new videoinput object cannot be
created for this device while it is in use.
Error in imaq.VideoDevice (line 270)
Code:
output_dir = 'C:\Users\HITESH\Desktop\Matlab';
%%set up webcam
leftCam = imaq.VideoDevice('winvideo', 2, 'YUY2_640x480');
rightCam = imaq.VideoDevice('winvideo', 1, 'YUY2_640x480');
%%load stereo parameters if required
if ~exist('stereoParams', 'var')
load stereocalibration.m;
end
ax = axes;
maxDepth = 5;
while true
imageLeft = step(rightCam);
imageRight = step(leftCam);
[J1, J2] = rectifyStereoImages(imageLeft, imageRight, stereoParams);
disp = disparity(rgb2gray(J1), rgb2gray(J2), 'DisparityRange', [0, 112]);
pointCloud = reconstructScene(disp, stereoParams) ./1000;
z = pointCloud(:,:,3);
z(z<0) = NaN;
z(z>maxDepth) = NaN;
pointCloud(:,:,3) = z;
if ~ishandle(ax)
break;
else
showPointCloud(pointCloud, J1, 'VerticalAxis', 'Y', 'VerticalAxisDir', 'Down', 'Parent', ax);
xlabel('X (m)');
ylabel('Y (m)');
zlable('Z (m)');
xlim(ax, [-.8, .8]);
ylim(ax, [-.8, .8]);
zlim([ax, maxDepth]);
drawnow;
end
end
release(leftCam);
release(rightCam);
MATLAB: R2015aHitesh Phttps://jp.mathworks.com/matlabcentral/profile/authors/14613530-hitesh-ptag:jp.mathworks.com,2005:Question/4446532019-02-13T01:13:09Z2019-02-18T06:55:11ZHow can I remove the region outside of the vector data when I combine the vector and raster data on the same map?Hi All,
I just plot a map combine the vector data and raster data with the following code,
load mapdemo.mat
ax = worldmap(latlim, lonlim);
surfm(Lat_lon,Lon_lat,China_data);
symbols=makesymbolspec('Polygon',{'default','FaceColor','none', 'LineStyle','--','LineWidth',0.2, 'EdgeColor',[0 0 0]});
geoshow('bou2_4p.shp', 'FaceColor','w','FaceAlpha',0,'EdgeColor','black','LineWidth', 1)
colorbar
However, I want to obtain a map like this,
I am wondering how can I remove the region outside of the vector data in the first figure to get the second figure. Could you help me? If Matlab mapping toolbox is not propoer to realize such function, is there other software is capable of this function?
Thank you so much.
Yours,
Ricky Rui Lihttps://jp.mathworks.com/matlabcentral/profile/authors/14763408-rui-litag:jp.mathworks.com,2005:Question/4455042019-02-18T04:47:04Z2019-02-18T06:49:13ZPlotting multiple times in a functionHi , I amd new using matlab and I would want to know how can I plot every generation of child ( xh) and see how has improve each generation in each iteration of jj. Total of generations are 200.
Code is below.
clear all
close all
clc
f = @(x,y) x*exp(-x^2 -y^2);
Ge = 200; %generations
N = 50;
D = 2;
xl = [-2 ; -2];
xu = [2 ; 2];
aptitud = zeros(1,N);
x = zeros(2,N); %parents
for i=1:N
x(:,i) = xl+(xu - xl).*rand(2,1);
end
for jj=1:Ge
for i=1:N
fx = f(x(1,i),x(2,i));
if fx >= 0
aptitud(i) = 1/(1+fx);
else
aptitud(i) = 1+abs(fx);
end
end
xh = zeros(2,N); % children
for k=1:2:N
p1 = seleccion(aptitud);
p2 = p1;
while p2 == p1
p2 = seleccion(aptitud);
end
[h1,h2] = cruza(x(:,p1),x(:,p2));
xh(:,k) = h1;
xh(:,k+1) = h2;
end
% disp(xh);
pm = 0.3;
for i=1:N
for j=1:D
if rand > pm
else
xh(j,i) = xl(j) + (xu(j) - xl(j))*rand();
end
end
end
x = xh;
end
Cesar Ramirezhttps://jp.mathworks.com/matlabcentral/profile/authors/14648729-cesar-ramireztag:jp.mathworks.com,2005:Question/4450682019-02-15T00:16:09Z2019-02-18T06:48:43ZSimulinkである波の時間平均をScopeでモニターしたいSimulinkである波（例えばsin波）の時間平均をScopeでモニターしたいのですが，どのようにすればよろしいのでしょうか．
Hideyukihttps://jp.mathworks.com/matlabcentral/profile/authors/282003-hideyukitag:jp.mathworks.com,2005:Question/4446952019-02-13T08:56:26Z2019-02-18T06:35:29ZCalling python script with 'system'I am trying to run a python script from within MATLAB just using the system command, i.e.
[~,result] = system(['python myscript.py someInputFile.out'])
This script relys on a library (openAi gym). When I try to run this python script I get:
import gym
ImportError: No module named gym
The script works fine when I call it from the command line. My python version is the same as is used in my shell. I'm not an expert in python, but I know MATLAB launches works inside its own shell, maybe there is there something I need to do to ensure that the 'gym' module is in my python path?
I know there are more elegant ways now to integrate MATLAB and python, but I'm under a bit of time pressure and was hoping for a quick fix.
Thanks!adajagahttps://jp.mathworks.com/matlabcentral/profile/authors/7413563-adajagatag:jp.mathworks.com,2005:Question/4455142019-02-18T06:31:33Z2019-02-18T06:31:33Zhow to change the color of lung portion only from binary image?fatimahttps://jp.mathworks.com/matlabcentral/profile/authors/14809986-fatimatag:jp.mathworks.com,2005:Question/4454822019-02-18T00:27:05Z2019-02-18T06:31:01ZSaving multiple figures of loop in one subplotIs it possible to save figures of different loops in 1 sub plot?For example:there are 3 different training and testing datasets.I want to save the results of all three datasets in 1 subplot.Thank you.
Suppose dataset of 3 homes
data1 =Home 1;
date2=Home 2;
date3=Home 3;
i=data1+data2+data3;
for j=1:i
-----
end
% After training a model;
results_home1=actual Vs Predicted ; % suplot 1
results_home2=actual Vs Predicted ; % suplot 2
results_home3=actual Vs Predicted ; % suplot 3
% All the above suplots in 1 figureAlihttps://jp.mathworks.com/matlabcentral/profile/authors/14555415-alitag:jp.mathworks.com,2005:Question/4434832019-02-06T11:02:59Z2019-02-18T06:21:25Zsimulink toolbox matlap onlineHi . i'm using matlap on the internet . i can not find the simulink toolbox ?Hind Alqhtanihttps://jp.mathworks.com/matlabcentral/profile/authors/14705859-hind-alqhtanitag:jp.mathworks.com,2005:Question/4450972019-02-15T06:44:20Z2019-02-18T06:20:48ZCalling multiple cell elements at onceHi I have a 1x10000 cell that I want to take out elements from. In my example here I use a 1x2 cell where I want to take out the first value C{1,1} and C{1,2}, and save it in a vector for a summation in a later stage. How can I do this?
C = {{1, 2, 3; 11,22,33;111,222,333},{1, 2, 3; 11,22,33;111,222,333}}Orongohttps://jp.mathworks.com/matlabcentral/profile/authors/2788537-orongotag:jp.mathworks.com,2005:Question/4453882019-02-17T09:26:47Z2019-02-18T06:14:45ZLittle Bit Help Required Regarding LoopHi EveryOne
I am currently working on this code
a=[1 2 3]
b=[3 4 5]
c=[34 5 6 ]
for i=1:1:3;
C = {[a];[b];[c]};
d= cellfun(@(v)v(i),C)
end
And the output is
d =
1
3
34
d =
2
4
5
d =
3
5
6
Every time loop runs it updated the last results.
I just want to save all the values means every time when loop run it keep save the last results and save the new results in the new coloumn
When I use
d(i)= cellfun(@(v)v(i),C)
The code give error
In an assignment A(I) = B, the number of elements in B and I must be the same.
Please help in this matter
Thanks
Regards
John Hockhttps://jp.mathworks.com/matlabcentral/profile/authors/11079478-john-hocktag:jp.mathworks.com,2005:Question/4434212019-02-06T03:06:05Z2019-02-18T06:10:09Zhalf bridge LLC resonant converter transfer functionHello Everyone
I am trying to design digital compensator for half bridge LLC resonant converter, I need help to calculate the easy and fast way to find the transfer function of the open loop converter. If anyone have matlab code to find the transfer function please share it with me on my email syed_shah@seu.edu.cn. Thanks in advance.
Regards,
Syed shahSikandar Shahhttps://jp.mathworks.com/matlabcentral/profile/authors/13819922-sikandar-shahtag:jp.mathworks.com,2005:Question/4455132019-02-18T06:07:33Z2019-02-18T06:07:33ZCould anyone help me how to find the seed of the centroid in a random manner.The following code executes and gives the result.
code:
clear all
clc
centroids=2
dimensions = 2;
iterations = 10;
dataset_subset = 2;
load test1.mat
meas = meas(:,1+dataset_subset:dimensions+dataset_subset);
dataset_size = size (meas);
[idx,KMEANS_CENTROIDS] = kmeans(meas,centroids);
With respect to the above code the centroids is fixed to 2.
Could anyone help me to modify the code in such a way that the number of centroids needs to be selected in a random manner.
jaah navihttps://jp.mathworks.com/matlabcentral/profile/authors/11695462-jaah-navitag:jp.mathworks.com,2005:Question/4454552019-02-17T19:15:07Z2019-02-18T06:07:09ZHow can I make this code more efficient?close; clear all; clc;
global cp1 vp1 cp2 vp2 value gk;
A=1; % aggregate productivity
a=0.36; % capital share of output (alpha)
b=0.96; % subjective discounting (beta)
d=0.069;% depreciation
klow=0.1;
khigh=6;
knum=250;
kgrid = linspace(klow,khigh,knum);
uf = @(x)log(x);
pf = @(x)(A*(x.^a));
cp2=[cp2,pf(kgrid(1:knum))+((1-d)*kgrid(1:knum))]; %period 2
vp2=[vp2,uf(cp2(1:knum))];
for i=1:knum %period 1
for j=1:knum
cp1(i,j)=max(pf(kgrid(i))+(1-d)*kgrid(i)-kgrid(j),0);
vp1(i,j)= log(cp1(i,j))+(b*vp2(j));
end
value=[value,max(vp1(i,:))];
[val,loc] = max(vp1(i,:));
gk=[gk,kgrid(loc)];
end
figure
subplot(211)
plot(kgrid, value)
hold on
title ( ' the value function ' )
subplot(212)
plot(kgrid, kgrid)
hold on
plot(kgrid, gk, '*')
title ( ' the decision rule ' )
saveas(gcf,'optimal2.png')
What can I do to make this code take up less lines or compute faster?Kai Jensenhttps://jp.mathworks.com/matlabcentral/profile/authors/14275901-kai-jensentag:jp.mathworks.com,2005:Question/4455112019-02-18T06:05:29Z2019-02-18T06:05:29ZHow to Hybrid Programming to dll file?I have such few files to use Hybrid Programming to generate a dll file. Idon't know how to do it step by step.
Thanks in advance.
Crystal Lihttps://jp.mathworks.com/matlabcentral/profile/authors/6653081-crystal-litag:jp.mathworks.com,2005:Question/4454592019-02-17T20:31:27Z2019-02-18T06:04:29ZFor Loops with Struct and FieldsMy data is in a structure/filed format B{x}.F{x}.signals.values, The structures and fields are consistant ,Struct B{x} where x =1:inf, F{x} and signals are the same for every iteration of B{x}. However the values are of diffrent sizes and i need to vertically cancatenate to be able to plot the values in on graph.
I have been using the loop function below to try to get te data into one cell C so I use the Padcat function but either 6 or 8 produced errors
C ={};
cj =1;
j =1;
for j = 3:numel(B)
S = B{1,j};
fn = fieldnames(B{1,j}).';
for y = fn{1,j}
C{cj} = S.(y{:}).signals.values;
cj = cj+1;
end
end
Is there a way to better concantenate large cell or why do i get "Brace indexing is not supported for
variables of this type"
Thanks.
Franchttps://jp.mathworks.com/matlabcentral/profile/authors/4013188-franctag:jp.mathworks.com,2005:Question/4455062019-02-18T04:51:52Z2019-02-18T06:01:52ZHow Can I count the ascending runs in array ?if I have an array such as
x=[1 2 3 2 1 2 4 5]
I would generate a binary array for binary search
binaryarray= [1 1 1 0 0 1 1 1]
in binaryarry i would sign 1 along with ascending runs while 0 along with descending runs.Faraj Alyamihttps://jp.mathworks.com/matlabcentral/profile/authors/9511051-faraj-alyamitag:jp.mathworks.com,2005:Question/4454682019-02-17T21:29:49Z2019-02-18T05:45:35ZWhy am I not getting an array of answers from this operation?t=linspace(0,3.5,1000);
u=4*exp^(-0.45*t.)*sin(4*t. + 0.5);
I want u to be an array that is the same size as t, but whenever i try to run this matlab says I have a parse error at ')' referring to the first closing parenthesis. I also tried making u an anonymous function of t but I could not get that to work either. Zachary Heupelhttps://jp.mathworks.com/matlabcentral/profile/authors/14658811-zachary-heupeltag:jp.mathworks.com,2005:Question/791132013-06-14T18:16:47Z2019-02-18T05:42:33ZHow to generate a geographical heat map? (worldwide, country-level granularity)I want to create a geographical heat map like the following in MATLAB:
<<http://i.stack.imgur.com/64DJY.png>>
Each color is based on a list of country with a percentage associated to each of them:
Country with Codes: % of Hits
- United States (US): 36.29%
- India (IN): 18.24%
- United Kingdom (GB): 12.93%
- Spain(ES): 8.22%
- Australia (AU): 3.32%
- Canada (CA): 3.05%
- Germany (DE): 2.49%
- Netherlands (NL): 1.66%
- Israel (IL): 1.39%
- China (CN): 0.83%
How can I do it in MATLAB?
I looked at http://mathworks.com/products/mapping and Googled around but I didn't find any easy way to do it. Such kind of maps are commonly used (e.g. straightforward to do with the <https://developers.google.com/chart/interactive/docs/gallery/geomap?hl=en Google Chart API>) so I'm hoping someone here shares his/her experience.
Thanks,
Franck
[1]: http://i.stack.imgur.com/64DJY.pngFranck Dernoncourthttps://jp.mathworks.com/matlabcentral/profile/authors/2210440-franck-dernoncourttag:jp.mathworks.com,2005:Question/4455012019-02-18T04:23:19Z2019-02-18T05:41:57ZI am having set of images in four different classes. for all those i need to save thier histograms by creating the folders seperatly. How can save these?foldername = 'descriptor';
des = 'hist';
dataset = 'OASIS_MRI';
type = 'gallery';
class_names = ['{c1}','{c2}','{c3}','{c4}'];
image_names1 = ['img1.jpg','img2.jpg'.......];
image_names2 = ['img1.jpg','img2.jpg'........];
image_names3 = ['img1.jpg','img2.jpg'.......];
image_names4 = ['img1.jpg','img2.jpg'.......];
load gallery.mat
for class = 1:length(gallery)
for image = 1:gallery(class).Count
im = imread(gallery(class).ImageLocation{image});
des=histogram(im);
end
end
if~exist([foldername '\',dataset '\',type], 'dir')
mkdir= ([foldername '\',dataset '\',type]);
end
filename = ([foldername '\',dataset '\',type '\',num2str(class_names(class)) '\', image_names(1:end-3),'.mat']);
save(filename,des);Sneha Chennamsettyhttps://jp.mathworks.com/matlabcentral/profile/authors/14582937-sneha-chennamsetty