https://ww2.mathworks.cn/matlabcentral/answers/questionsMATLAB Answers — New Questions2020-07-03T14:28:34Ztag:ww2.mathworks.cn,2005:Question/5590132020-07-03T14:28:34Z2020-07-03T14:28:34ZAutoHotKey binding not working in MATLAB R2020aHello, I have an AutoHotKey binding "Ctrl"+"\|" to the character ~ for my italian keyboard layout to have access to the ~ character (I just used it twice here, so I know it's working!). But MATLAB (R2020a) doesn't seem to recognize it (I'm using Windows 10).
I've read through the following:
https://www.mathworks.com/matlabcentral/answers/482218-autohotkey-doesn-t-work-in-matlab
https://www.mathworks.com/matlabcentral/answers/472753-how-do-i-make-the-caps-lock-key-an-additional-backspace
https://www.mathworks.com/matlabcentral/answers/59015-matlab-does-not-play-well-with-autohotkey-how-to-fix
Nothing seems to offer a solution. The remapping of keys in REGEDIT does not work in my case because on the italian layout, windows still sees my "\|" key as the "~|" key, both mapped to 0x29 scancode. It's just that the italian layout drops the ~ character completely (frustrating for coders).
Any ideas on how to get MATLAB to recognize AutoHotKey inputs?
Alex Schrammhttps://ww2.mathworks.cn/matlabcentral/profile/authors/16805704-alex-schrammtag:ww2.mathworks.cn,2005:Question/5588932020-07-03T09:12:32Z2020-07-03T14:27:20Zmean of two matrix groups split by name Hello,
I have two groups of similar measures. Every file .mat with matrix M will be loaded from in loop and I want to make a mean of both groups separately (number of measures are symmetric)
"M4_Distance_0.5m_SONY_PCM_D50_F1_MS1" and "M4_Distance_2m_SONY_PCM_D50_F1_MS1":
013_M4_Distance_0.5m_SONY_PCM_D50_F1_MS1.mat
014_M4_Distance_0.5m_SONY_PCM_D50_F1_MS1.mat
015_M4_Distance_0.5m_SONY_PCM_D50_F1_MS1.mat
016_M4_Distance_0.5m_SONY_PCM_D50_F1_MS1.mat
017_M4_Distance_0.5m_SONY_PCM_D50_F1_MS1.mat
013_M4_Distance_2m_SONY_PCM_D50_F1_MS1.mat
014_M4_Distance_2m_SONY_PCM_D50_F1_MS1.mat
015_M4_Distance_2m_SONY_PCM_D50_F1_MS1.mat
016_M4_Distance_2m_SONY_PCM_D50_F1_MS1.mat
017_M4_Distance_2m_SONY_PCM_D50_F1_MS1.mat
I see a way to make it by count (if number of all *.mat files in folder are 10, so there are 2 groups with 5 files)
Or by name:
cnt1 = 0;
cnt2 = 0;
Res1 = zeros();
Res2 = zeros();
for .....
str = strsplit(name, '_')
str = str{1,end-5}
if strcmp(str,'0.5m')
Res1 = Res1 + M;
cnt1 = cnt1 + 1;
elseif strcmp(str,'2m')
Res2 = Res2 + M;
cnt2 = cnt2 + 1; % I know, one cnt is enough
end
end
mean1 = (Res1/cnt1)
mean2 = (Res2/cnt2)
Or maybe there are a better way to solve it? (There are sometimes up to 100 matrix) Thanks!Nik Rockyhttps://ww2.mathworks.cn/matlabcentral/profile/authors/7505467-nik-rockytag:ww2.mathworks.cn,2005:Question/5590102020-07-03T14:19:48Z2020-07-03T14:19:48ZHow to store data to a new column after each iteration.Hi,
I am looking at some data and each loop I define am sample from this data and the want to store it in a table.
So each time loop I want to add a new column to a table and store the data (so the table would ideally be (x1(1), x2(1), x1(2), x2(2)...etc) , however the length of this data is different each time and that seems to make it more difficult.
Am wondering if theres any obvious way to do this, or just to store it directly into a excel file in this format.
thank you in advance.
m=[];
for x=1:9
FileName= sprintf('A_S_%d.txt', x); %read file
data = importdata(FileName);
t=data(:,1);
d=data(:,2);
Max_Depth= max(d);
[maxvaly,idx] = max(d) ;
Time = t(idx) ;
[val,idx2]=min(abs(d));
minVal=d(idx2);
Time2 = t(idx2) ;
tableA(x,:)=[{x} Time2 minVal Time Max_Depth];
t3 = array2table(tableA, 'VariableNames', {'Repeat','Time_of_Impact_s','Impact_Depth_nm', 'Time_of_Max_Depth_s', 'Max_Depth_nm'});
x1=t([idx2:idx]);
x2=d([idx2:idx]);
% m=[m; t([idx2:idx])];
% m=[m; d([idx2:idx])];
m=[m;x1;x2;]
plot(x1,x2); hold on
title ('Impact Depth From 0 to Max'), xlabel('Time(s)'), ylabel('Impact Depth (nm)')
end
Lizzy tatarekhttps://ww2.mathworks.cn/matlabcentral/profile/authors/10150819-lizzy-tatarektag:ww2.mathworks.cn,2005:Question/5589232020-07-03T10:11:59Z2020-07-03T14:19:39Zorder of filenames is wrongHello,
I have save some measures in loop with
SNR = 30
SNR_steps = 15
-SNR:SNR_steps:SNR
ans = -30 -15 0 15 30
I use SNR also in part of filename and get:
The Problem: the order of files in folder (-015 before -030) but I wont have -030, -015, 000, 015, 030...
Why is this happening and how can I awoid this situation?
Thank you! Nik Rockyhttps://ww2.mathworks.cn/matlabcentral/profile/authors/7505467-nik-rockytag:ww2.mathworks.cn,2005:Question/5573142020-06-30T15:36:42Z2020-07-03T14:16:51ZHow to read and write multiple .txt files with unpatterned names into a table?Hi everyone,
I have a multiple .txt files (31) each containing 4 columns with headers and 2000 rows.
What I am trying to do is, to import the first 1000 column for each file and combine them into a table by horizontal concatenation and do the same for the second 1000 column to obtain a second table than write them into 2 separate excel files.
I have read most of the related headers but it seems a bit challenging to manage the files with unpatterned names. I have attached a couple of the .txt files for an example.
I used the "generate function" from the import tool which works fine, but does the job for only a single .txt file. Is it possible to insert a loop into this auto generated function? Or is there a simpler way?
function mA = importfile1(filename, dataLines)
%IMPORTFILE1 Import data from a text file
% MA = IMPORTFILE1(FILENAME) reads data from text file FILENAME for the
% default selection. Returns the data as a table.
%
% MA = IMPORTFILE1(FILE, DATALINES) reads data for the specified row
% interval(s) of text file FILENAME. Specify DATALINES as a positive
% scalar integer or a N-by-2 array of positive scalar integers for
% dis-contiguous row intervals.
%
% Example:
% mA = importfile1("C:\Users\uzumcu\Desktop\MatlabDrive\QCL measurements\22-06-20\1726 RG 2.2 SG 2 Current\400mA.txt", [2, 1002]);
%
% See also READTABLE.
%
% Auto-generated by MATLAB on 30-Jun-2020 17:33:31
%% Input handling
% If dataLines is not specified, define defaults
if nargin < 2
dataLines = [2, Inf];
end
%% Setup the Import Options and import the data
opts = delimitedTextImportOptions("NumVariables", 4);
% Specify range and delimiter
opts.DataLines = dataLines;
opts.Delimiter = "\t";
% Specify column names and types
opts.VariableNames = ["PointsReference", "AmplitudeReference", "PointsSample", "AmplitudeSample"];
opts.VariableTypes = ["double", "double", "double", "double"];
% Specify file level properties
opts.ExtraColumnsRule = "ignore";
opts.EmptyLineRule = "read";
% Import the data
mA = readtable(filename, opts);
end
Any help could be really appreciated since I am trying to figure this out for 3 days.
Thank you all in advanceAHMET TALHA UZUMCUhttps://ww2.mathworks.cn/matlabcentral/profile/authors/10125058-ahmet-talha-uzumcutag:ww2.mathworks.cn,2005:Question/5589562020-07-03T11:44:32Z2020-07-03T14:15:23ZHistogram in App DesignerSo I have this excel file and i want to make an histogram or scatter in app desginer for smoke and non smoker, can someone help me out ? I can't figure it out, because in the excel Smoker is just one column, and i want to make a histogram with 2 bars (different colours), one is for the smokers, and the other one is for non smokers.Diogo Costahttps://ww2.mathworks.cn/matlabcentral/profile/authors/18370136-diogo-costatag:ww2.mathworks.cn,2005:Question/5590072020-07-03T14:13:31Z2020-07-03T14:13:31ZAdding Data with the Column Names into app.UITableHello, I've built a pretty complex App thus far. It has a lot of options for specific variables and timeframes that a user wants to import for data files. After the user selects the Import Parameters for the file, I want the imported table to be read onto the app.UITable that i've added onto my GUI. I am using the lines
my_table = timetable2table(TimeTableOut); % converts the time table back into a regular table b/c
% for some reason you can't import a time table into a uitable.
app.UITable.Data = my_table;
This works but it only imports the data into the table, there are no Variable Names (column names) for the data. I have never used a UI Table within my GUI (recently I just used a figure then a uitable) so I don't know the functions of all the properties. The variables should be saved under opts.SelectedVariableNames, so maybe I could somehow add those to the UI Table? Any help would be appreciated! Forrest Wardhttps://ww2.mathworks.cn/matlabcentral/profile/authors/16750070-forrest-wardtag:ww2.mathworks.cn,2005:Question/5590042020-07-03T14:13:08Z2020-07-03T14:13:08ZHow can I rotate the view of a geoplot?Hi
I would like to plot a flight path on a map and rotate the view on the map so that the latest heading is pointing towards the top (or a simpler formulation: I would like to rotate the view of a geoplot). However, it seems like I cannot rotate the view of the geoplot using e.g. view() or 'Rotate' tool.
The simple code I am using as an example is below.
Is there a way to rotate the view of the plot I am doing below? Or is there another way to plot on a map and then rotate?
Thanks in advance.
Kind regards,
Arno
name = 'opentopomap';
url = 'a.tile.opentopomap.org';
copyright = char(uint8(169));
attribution = [ ...
"map data: " + copyright + "OpenStreetMap contributors,SRTM", ...
"map style: " + copyright + "OpenTopoMap (CC-BY-SA)"];
displayName = 'Open Topo Map';
addCustomBasemap(name,url,'Attribution',attribution, ...
'DisplayName',displayName)
posX = 9.95;
posY = 46.38;
pathX = [9.87 9.92 9.95 posX];
pathY = [46.27 46.3 46.35 posY];
gx = geoaxes;
geoplot(posY,posX,'*r',pathY,pathX,'-b')
geobasemap(name)
geolimits([posY-0.15 posY+0.15],[posX-0.15 posX+0.15])
% view([90 90])Arno Frauenfelderhttps://ww2.mathworks.cn/matlabcentral/profile/authors/13617350-arno-frauenfeldertag:ww2.mathworks.cn,2005:Question/5573772020-06-30T17:56:55Z2020-07-03T14:08:39ZWhy does performance of functions saturate with number of cores using parfeval but not with parfor?I am developing an application that MUST take advantage of parallelization, and ideally offer real-time updates after each iteration, which makes use of parfeval prefarable. I believe the algorithm that I have developed is highly parallelizable (see attached for performance of 'WT_Ex_2_b' as a function of number of cores used in parfeval function). From 1 to 8 cores, the speedup factor agrees with theoretical expectation (Amdahl's Law with p=0.95), however, performance of my application saturates at 8 cores. This led me to create a dummy function (see attached script) to compare the performance of using parfor and parfeval as a function of number of cores. I discovered that the parfor version behaves quite similarly to theoretical expectation (Ahmdal's Law, also with p=0.95), however the parfeval version continues to show strange saturation behavior, even for the dummy function. Notice how the Speedup factor improves with core number upto 12 cores, then suddenly no further improvement is observed. I have attached the script in case you want to reproduce this behavior on your end.
Is there a fundamental limitation to the number of cores the parfeval function can leverage? Or is there an obvious mistake I am making in the way I am using the parfeval function? Why does the performance behavior of the dummy algorithm suddenly saturate at 12 cores? Any recommendation how to use the parfeval function to perform as well as parfor?
I would like to emphasize that I have already developed my application to use parfeval, so converting to parfor would be time-consuming and prevent me from utilizing the update-after-iteration feature of parfeval.
Thank you for your help on this critical matter. Joseph Smalleyhttps://ww2.mathworks.cn/matlabcentral/profile/authors/13751435-joseph-smalleytag:ww2.mathworks.cn,2005:Question/5590012020-07-03T14:07:45Z2020-07-03T14:07:45ZYaw Values of Actors in Driving Scenario DesignerI need to observe certain driving scenario with manipulated yaw values of actors. But it seems the yaw values are ignored! Is there any way to enable them?Sunandan Adhikaryhttps://ww2.mathworks.cn/matlabcentral/profile/authors/16536087-sunandan-adhikarytag:ww2.mathworks.cn,2005:Question/5589982020-07-03T14:02:43Z2020-07-03T14:02:43ZI'm currently modelling a motor for a vehicle, for which I have a built multibody system, however, when I implemented the electrical system to the physical system, the time to simulate increases to an unreasonable levelI've recently been modelling a crane in using Simulink, and as part of that, I am modelling the electronics of the crane's hoist motor. Howevever, when I brought the motor; modelled using a field oriented control induction motor drive, into my multibody model, the time to simulate increased to the point where it takes over ten minuted to simulate a tenth of a second. Without the motor, it takes just a few minutes to simulate a 22 second simulation. I believe this is a consequence of the Powergui timestep, affecting the time steps in which the multibody systems are actuated. For context I use a discrete Powergui, and the ODE23T solvers, respectively.
Any advice on how to reduce time to simulate would be greatly appreciated.Harry Knoblauchhttps://ww2.mathworks.cn/matlabcentral/profile/authors/18719059-harry-knoblauchtag:ww2.mathworks.cn,2005:Question/5589142020-07-03T10:00:05Z2020-07-03T14:01:48ZIs an infinite for loop infinite?This is a rather theoretical Question: If i have a for loop i=1:Inf, will the loop run forever or stop, when the loop index exceeds realmax? The loop index still grows after reaching 2^53, so matlab seems to have some internal measures to counter precision loss in this case...Jonathan Vorndammehttps://ww2.mathworks.cn/matlabcentral/profile/authors/12716784-jonathan-vorndammetag:ww2.mathworks.cn,2005:Question/5589952020-07-03T13:58:39Z2020-07-03T13:58:39ZHow to extrapolate a contour plot?Hello,
I have measured the thickness of a quarter of an 8 inch substrate (the filled area in the below picture shows the area where thickness was measured). Basically I have a z value for different x and y values.
I have shown a sample of my data below:
x y z
-4 4.5 1015.21
-3 4.5 1015.01
-2 4.5 1013.46
-1 4.5 1011.95
0 4.5 1008.35
1 4.5 1002.58
I was able to make a contour plot with the data I have. Now, I want to extrapolate the data to predict the thickness in the other quadrants. Is this possible with MaLab? It would be great if someone can help me with this.
Thanks in advance
Best Regards,
Bala
Balasubramanian Sundarapandianhttps://ww2.mathworks.cn/matlabcentral/profile/authors/9046418-balasubramanian-sundarapandiantag:ww2.mathworks.cn,2005:Question/5589862020-07-03T13:31:09Z2020-07-03T13:55:54ZContaminate an EMG with 50 Hz signalI am trying to add a 50 Hz sinusoidal signal to an EMG signal but it isn't working. The amplitude of the 50 Hz signal should be 5% of the EMG signal amplitude. Can you give me with some tips on how to do it? I wrote the 50 Hz contamination like this: y = 0.005.*sin(2.*pi.*Fc.*t),
Thank you very much!Dora Barbushttps://ww2.mathworks.cn/matlabcentral/profile/authors/16879007-dora-barbustag:ww2.mathworks.cn,2005:Question/4832702019-10-02T16:37:24Z2020-07-03T13:54:35ZError while setting up simscape multibody link for inventorsalman shihabhttps://ww2.mathworks.cn/matlabcentral/profile/authors/12603646-salman-shihabtag:ww2.mathworks.cn,2005:Question/5589772020-07-03T12:55:38Z2020-07-03T13:49:01ZMatLab crashing while saving variableHello,
I am facing issues saving variables from my workspace. MatLab always crashes when I try to save handle objects.
When I test it with less objects it works all fine, but when I try it with my desired number it just crashes.
I dont expect the size of the reuslting mat file to exceed 2GB, however i set -v7.3 as default in my preferences for saving manualy by right clicking "save as", but I also tried it within the code as
save('test','grains','-v7.3')
Both didnt help and it just crashed.
I uploaded a file where u can see the structure if my objects, in this case there are 2000 objects, filesize is 246KB, I also can save 40k objects, filesize is now 150MB, but my desired value of 160k objects cant be done...
I use Win 10 64bit as OS and MatLab 2019b
Does anybody has an idea how i can save these many objects so i can use same as input and dont have to recalculate them everytime?
Many thanks in advance
Best regards
Marc Laubhttps://ww2.mathworks.cn/matlabcentral/profile/authors/9006977-marc-laubtag:ww2.mathworks.cn,2005:Question/5234972020-05-06T15:58:44Z2020-07-03T13:47:17Zparsing error with clibgenI get parsing errors with clibgen.generateLibraryDefinition(HeaderFiles)
running mex -setup cpp
results in:
MEX configured to use 'Microsoft Visual C++ 2019' for C++ language compilation.
Why do I get errors from a standard utility header?
Errors parsing header file.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include\utility:96: expected an
identifier.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include\utility:95: not a valid
member class or function template declaration.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include\utility:95: "explicit" is
not allowed.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include\utility:97: expected a ";".
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include\utility:177: expected an
identifier.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include\utility:177: expected a
")".
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include\utility:177: not a valid
member class or function template declaration.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include\utility:177: "explicit" is
not allowed.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include\utility:177: expected a
";".SKhttps://ww2.mathworks.cn/matlabcentral/profile/authors/11645181-sktag:ww2.mathworks.cn,2005:Question/2686692016-02-17T17:33:16Z2020-07-03T13:45:48ZHow to find state transition matrix with symbolic parameters efficientlyHi
I am going to find the state transition matrix of a 4x4 system. But matlab ran for a long time without giving a solution. Is there any other ways to find the solution?
Thanks
syms t
A=[-2.1 -0.98 -0.158 -2.05
2.22 -11.03 0 0
-27.64 0.19 -6.39 -82.6
0 0 1 0]
TM=expm(A*t)xianjie Zhouhttps://ww2.mathworks.cn/matlabcentral/profile/authors/3654747-xianjie-zhoutag:ww2.mathworks.cn,2005:Question/4674982019-06-17T15:48:30Z2020-07-03T13:45:46ZApplication Compiler app stopped by Windows Defender SmartscreenHello,
I've completed an application and created an executable using the Application Compiler. The executable runs fine on my computer, but when I send it to a colleague, he gets the following popup from WIndows Defender SmartScreen. There's a chance that our company's security settings have caused this, but I want to see if anyone here has an idea. FYI, built on Windows 10 64-bit, Matlab 2019a 64-bit.
Matthew Reaveshttps://ww2.mathworks.cn/matlabcentral/profile/authors/6263878-matthew-reavestag:ww2.mathworks.cn,2005:Question/5589922020-07-03T13:45:25Z2020-07-03T13:45:25ZDoes 'Data Store Memory' block write the data to embedded system memory?I have couple of questions actually,
1)Does 'Data Store Memory' block in Simulink write the data to embedded system memory?
2)If so, does it store last (one) data?
3)If so, can it do also when embedded system doesn't even work? (In case of energy supply is not working)
4) If so, what if I dont have enough space at my embedded system?
Thanks.Baran Celilktenhttps://ww2.mathworks.cn/matlabcentral/profile/authors/18047107-baran-celilktentag:ww2.mathworks.cn,2005:Question/4213482018-09-29T08:33:45Z2020-07-03T13:43:42ZHow to read spectrogram outputs and pick out interesting time-window?I am trying to determine where the strongest EEG activity happens, and how long it lasts (or what is the shortest time of this high activity which is enough to be recognized while implementing in BCI system for human use). I need to pick out the strongest activity and its lasting time, to save in a vector which I use later in classification of different kind of signals. For this I want to use PSD.
While reading literature review I noticed that many researchers uses Matlab’s spectrogram function and it looks like good one because of possibility to handle input parameters interesting for analyzing my EEG data. https://se.mathworks.com/help/signal/ref/spectrogram.html#bultmx7-s
I have attached EEG raw data that is 20 seconds long.
The rest of the parameters are:
xy is the EEGdata attached to this question.
NFFT= length((xy)); %10240
window=512;
noverlap=384;
Fs=512;
If I run the spectrogram function with no output parameter I get the PSD of the signal presented in the picture below the code
spectrogram(xy,window,noverlap,NFFT,Fs,'yaxis' );
<</matlabcentral/answers/uploaded_files/134136/Fig_1.PNG>>
It is easy to just zoom in and inspect visually where the activity is strong, but how do I do that in Matlab programmatically? I understand that spectrogram function gives PSD as well as a result in output parameters. So I have tried with this combination of outputs:
[s, f, t, ps] = spectrogram(xy,window,noverlap,NFFT,Fs,'yaxis' );
But the problem is that I need help to understand what the result is? What are rows and columns? Why are number of rows 5121 and columns 77? How can I use that information to get out the best activity and how long that activity lasts?
If I understand it correctly, the s is returning complex sfft of the signal, but why is there 77 columns? I guess it has to do with windowing and the result of segmenting the signal, but how can I be sure that it is like that?
If I use s_real =real(s); I will get real part of fft, still 77 columns and 5121 rows.
If I use s_mag= abs(s); I will get magnitude of fft, still 77 columns and 5121 rows.
If I use PSD= 1/(Fs*10240).*s_mag.^2 I will get PSD, and still 77 columns and 5121 rows.
From question
https://se.mathworks.com/matlabcentral/answers/280260-why-are-the-results-of-my-spectrogram-sinusoidal
In the description of spectrogram function, it stands that s matrix contains time and frequency: “time increases across the columns of s and frequency increases down the rows”. But the time in my resulting columns is not increasing. So what does the rows and columns representing? How can I use that data to find strongest activity and time window?
The output matrix ps from spectrogram function does not have the same result values as PSD result from PSD= 1/(Fs*10240).*s_mag.^2. Why are they different?
One more thing, if using spectrogram function with output parameters, the plot is empty- why is that? How can I plot PSD of frequency and time on x-axis? How can I plot chosen EEG activity PSD and its time using Matlab? If I use the code plot(t(:,:),PSD); I get following figure. What is represented on y-axis? I understand that I put PSD in the plot function, but how can I read from the figure what frequency give strongest value?
<</matlabcentral/answers/uploaded_files/134137/Fig_2.PNG>>
Later, when implementing chosen time window, for example, if I chose 1 second time window, how do I write the code to check for 2 second long time window? What I want with this is to inspect if the 2 second time window gives more accurate result then 1 second time window.
Any help will be gratefull!
Marijana Teljegahttps://ww2.mathworks.cn/matlabcentral/profile/authors/6339179-marijana-teljegatag:ww2.mathworks.cn,2005:Question/5587642020-07-03T03:05:33Z2020-07-03T13:43:39ZHow to matlab display matrix in different way matlab display matrix is very problenatic question. my question is How to matlab display matrix as image and Table
example:
For example:
B = magic(3)
disp('The ANS is:')
disp(B)
then how I can display I am see the ans on matlab but i need in detailed.Sachin Pagarhttps://ww2.mathworks.cn/matlabcentral/profile/authors/18903129-sachin-pagartag:ww2.mathworks.cn,2005:Question/5589892020-07-03T13:43:01Z2020-07-03T13:43:01ZHow can I set pramaters of Simscape Solver Configuration block?I know how to access for example the LocalSolver setting of the Solver Configuration Block:
set_param('Derating/Solver Configuration','UseLocalSolver',0)
but how to access the "start simulation from steady state"?
thanks in advance!Michael Ludwighttps://ww2.mathworks.cn/matlabcentral/profile/authors/6175038-michael-ludwigtag:ww2.mathworks.cn,2005:Question/4075022018-06-26T14:21:15Z2020-07-03T13:41:36ZIncompatible gcc version with mexI run Ubuntu 18.04. When I try to compile files with mex, I get the error message saying that mex requires version 6.3.x of gcc, whereas the default gcc version on 18.04 is 7.3.
So far so good, I try to get my hands on an older version of gcc, but all i can find through the supported repositories is gcc version 6.4. The only way I seem to be able to get specifically version 6.3 is by manually compiling and installing gcc, but frankly, I do not want to go down that rabbit hole.
I have seen your <https://se.mathworks.com/matlabcentral/answers/48313-why-doesn-t-matlab-support-newer-gcc-versions answer> regarding why you don't always support the latest gcc version, but can you please at least offer support for the latest version of gcc 6 (i.e. 6.4.x)?Andréas Sundströmhttps://ww2.mathworks.cn/matlabcentral/profile/authors/4609475-andreas-sundstromtag:ww2.mathworks.cn,2005:Question/95722011-06-15T18:50:12Z2020-07-03T13:39:43Zkeep figures from popping up when running.I am doing a lot of batch processing in which I creating many figures. I would like to keep these figures in the background while running the Matlab code without the Figure window popping up each time a new figure is created. Is there an easy way to do this?
When the figure pops up it disrupts anything else you are doing on the computer.Michael Marcushttps://ww2.mathworks.cn/matlabcentral/profile/authors/910744-michael-marcustag:ww2.mathworks.cn,2005:Question/5585902020-07-02T17:26:58Z2020-07-03T13:38:42Zhow to obtain the frequency when doing the fourier trasformHi,
I am applying the fast fourier trasform to a timeseries. When I plot the transform (or better its absolute value) I would like to have on the x axis a range of frequency but I am not sure how to calculate that.
I am working with data that are each minute and are registered in a timetable.
Thanks in advance,
Giacomo
giacomo labbrihttps://ww2.mathworks.cn/matlabcentral/profile/authors/13691820-giacomo-labbritag:ww2.mathworks.cn,2005:Question/5578632020-07-01T16:07:44Z2020-07-03T13:37:18ZWhy I can't use the function of decimateHi, I try an example of decimation stated in matlab. But I don't get the result as shown in the example. What should I do? Below shows the result that I run in my matlab. The first image is from the examaple, the second image is the result that I get.
t = 0:1/4e3:1;
x = sin(2*pi*30*t) + sin(2*pi*60*t);
y = decimate(x,4);
subplot(2,1,1)
stem(0:120,x(1:121),'filled','MarkerSize',3)
grid on
xlabel('Sample Number')
ylabel('Original')
subplot(2,1,2)
stem(0:30,y(1:31),'filled','MarkerSize',3)
grid on
xlabel('Sample Number')
ylabel('Decimated')
Aminatul Saadiahhttps://ww2.mathworks.cn/matlabcentral/profile/authors/12877412-aminatul-saadiahtag:ww2.mathworks.cn,2005:Question/4840832019-10-07T22:40:10Z2020-07-03T13:32:57ZCan I add an existing test harness to my modelI have some how overwritten my existing harnessinfo.xml and some of the test harness tag is missing. As a result I can not see all th etest harnes in the badge ribbon .
How do I add them again ?
or is there a way to fine HarnessUUId of a particular test harness ?Avinash Chandrahttps://ww2.mathworks.cn/matlabcentral/profile/authors/15867569-avinash-chandratag:ww2.mathworks.cn,2005:Question/5585872020-07-02T17:21:49Z2020-07-03T13:28:30ZHow can I plot shaded confidence intervals on my plot?I am trying to plot the confidence intervals for males and females on my graph. I have been using simple line plots for the female and male data and their upper and lower confidence intervals, using the following code
x=[5,610,1115,1620,2125,2630,3135,3640,4145,4650];
y=[1.5728,1.6011,1.5828,1.583,1.5779,1.5931,1.6136,1.6132,1.6354,1.6512];
CI = [0.047204964 0.020555517 0.030005595 0.023338819 0.030057518 0.026567109 0.027295407 0.025855224 0.029278635 0.028793178]; %CI values
y2 = [1.4904,1.625,1.5834,1.6213,1.6135,1.6378,1.6212,1.6563,1.662,1.6657,1.6462,1.7267]
x2 = [5,610,1115,1620,2125,2630,3135,3640,4145,4650, 5155, 5660]
CI2 = [0,0.02859404,0.03932538,0.031767406, 0.033377728,0.033181883,0.02925182, 0.030260765,0.028698134,0.026206678,0.035101913,0]
plot(x, y, 'color', [0, .6, .77])
hold on
plot(x, y-CI, ':', 'color', [0, .6, .77])
hold on
plot(x , y+CI, ':','color', [0, .6, .77])
hold on
plot(x2, y2, 'color', [.89, 0, .23])
hold on
plot(x2, y2-CI2, ':', 'color', [.89, 0, .23])
hold on
plot(x2 , y2+CI2, ':','color', [.89, 0, .23])
hold off
ylabel('vTMD')
xlabel('Depth (%)')
xticks([5, 610, 1115, 1620, 2125, 2630, 3135, 3640, 4145, 4650, 5155, 5660])
xticklabels({'0-5', '6-10', '11-15', '16-20', '21-25', '26-30', '31-35', '36-40', '41-45', '46-50', '51-55', '56-60'})
This gives me a graph that looks like this -
Is there a way to shade the individual CI as it is pretty hard to read right now! For example, a lighter blue in between the dashed blue lines.Samhttps://ww2.mathworks.cn/matlabcentral/profile/authors/17574141-samtag:ww2.mathworks.cn,2005:Question/5575872020-07-01T07:31:56Z2020-07-03T13:26:57ZI have surface data stored in faces and vertices. How to extract data in a slice (or 2D plane) from this Faces and vertices data?I have surface data stored in faces and vertices. How to extract data in a slice (or 2D plane) from this Faces and vertices data?Sachin Shindehttps://ww2.mathworks.cn/matlabcentral/profile/authors/14775191-sachin-shindetag:ww2.mathworks.cn,2005:Question/5560242020-06-28T10:27:32Z2020-07-03T13:25:12ZWhat frustrates you about MATLAB? #2Similar to what has happened with the wishlist threads (#1 #2 #3 #4 #5), the "what frustrates you about MATLAB" thread has become very large. This makes navigation difficult and increases page load times.
So here is the follow-up page.Rikhttps://ww2.mathworks.cn/matlabcentral/profile/authors/3073010-riktag:ww2.mathworks.cn,2005:Question/5589412020-07-03T11:32:22Z2020-07-03T13:23:37ZExtract a row from a 2D matrix if any of its element matches with elements in other 1D matrixI have 2D matrxi A (size: 10000 x 3) and 1D matrix B (size: 5000 x 1)
If one elemnt of row in A matches with any element in B, then that rwo sfould be separated out. Suppose there are N such rows then I want the output as a matrix C (size: N x 3), (which is a subset of A).
I am using the code:
counter = 0
for i = 1:length(A)
if sum(ismember(A(i,:),B)) >= 1
counter = counter + 1;
C(counter,:) = A(i,:);
end
end
This gives me the output I want, but it takes huge time especially on very large sized matrices.
Any one/two liner replacment to speed up the code?
Thanks.
Sachin Shindehttps://ww2.mathworks.cn/matlabcentral/profile/authors/14775191-sachin-shindetag:ww2.mathworks.cn,2005:Question/5589652020-07-03T12:15:05Z2020-07-03T13:14:00Zconverting multiple file of 4D to 3D files i have 80 files of 4D double (140x122x180x#)
i need the files in 3D (140x122x180)
i have tried these solutions but does not come out as expected
files = B % 140x122x180x#
threeD = permute(files[1,2,3,4])
% the result will be 4D double
% i also tried
threeD = squeeze(num2cell(permute(files,[1,2,3,4]),1:3))
% the result will be #x1 cells
current coding :
cd ('path');
files=dir('*.mat'); % find all |.mat| files in the current directory.
totalfile = numel(files); % count those files.
C = cell(1,totalfile); % preallocate a cell array for the loaded data.
for a = 1:totalfile % loop over the number of files.
T = load(files(a).name) % load the data from each file
C(a) = struct2cell(T); % convert structure to cell, allocate to cell array.
M = cat(4,C{:}) % concatenate all MxN matrices into MxNxP array,
% 3 dimensional concatenate
% ???
save(['path/zscore_' num2str(a) '.mat'],'M');
end
thank you Hanisah nohhttps://ww2.mathworks.cn/matlabcentral/profile/authors/18225027-hanisah-nohtag:ww2.mathworks.cn,2005:Question/5589802020-07-03T13:02:02Z2020-07-03T13:12:00ZCreate a grid on an imageHello, this is my code:
for P = shaping
% Position beacon
img(1:n, 1:n,1+flag) = 255;
img(end-n:end, end-n:end,1+flag) = 255;
img(1:n, end-n:end,1+flag) = 255;
img(end-n:end,1:n,1+flag) = 255;
% We add the information only on the blue channel and add beacon
encodedBuffer(:,:,:,index) = frameBuffer(:,:,:,index);
encodedBuffer(:,:,3,index) = encodedBuffer(:,:,3,index) + ...
P*codeImage+img(:,:,1+flag);
index = index + 1;
end
I want to create some beacons on an image I have created, in which every time I enter this function (this loop belongs to a function) the value of flag will be changed to negative flag. Initially flag is 0. It creates the 4 squares inside the image but instead of being red or green it becomes blue (the image I'm adding it to is blue).Alberhttps://ww2.mathworks.cn/matlabcentral/profile/authors/17014507-albertag:ww2.mathworks.cn,2005:Question/5588542020-07-03T07:14:52Z2020-07-03T13:10:55Zsyntax error in simulinki cannot run my simulation due on this function. can you help me to identify the problem.
p(1)*u(2) + p(2)*u(1) + p(3)*u(1)*u(1) + p(4)*u(1)*u(2) + p(5)Fadzliana Aidahttps://ww2.mathworks.cn/matlabcentral/profile/authors/18450021-fadzliana-aidatag:ww2.mathworks.cn,2005:Question/5589682020-07-03T12:28:09Z2020-07-03T13:08:50ZIs it possible that ode23 or ode45 could result in complex numbers instead of real ones? If Yes, what are the possible reasons for getting complex numbers once you would expect real ones?Hi, I perfromed ode23 for solving a differential equation, but after some timesteps I started to get complex numbers (i.e. the imaginary part) as result, instead of real numbers. Based on my equations/calculations, I should always get real numbers, and I do not understand if/why those solvers could give imaginary numbers.
Therefore, Is it possible that ode23 or ode45 could result in complex numbers instead of real ones?
If Yes, what are the possible reasons for getting complex numbers once you would expect real ones?
More info on the ODE here:
https://it.mathworks.com/matlabcentral/answers/558265-error-in-using-ode23t-to-solve-a-differential-equation-on-a-graph-network?s_tid=mlc_ans_email_ques
Thanks a lot!Simhttps://ww2.mathworks.cn/matlabcentral/profile/authors/14233052-simtag:ww2.mathworks.cn,2005:Question/5584362020-07-02T13:07:51Z2020-07-03T13:08:48Zgetting error about wrong input argumenti have tried following code for upsampling of data with input values
smote('C:\Users\Haleema\Desktop\skin matlab\orignal', 8,{327,514,1099,115,1113,6705,142})
but got error
Error using bar (line 127)
Input arguments must be numeric, datetime, duration or categorical.
Error in barh (line 44)
h = bar(varargin{:});
Error in smote (line 22)
barh(sortedIDX);
function allData_smote = smote(allData, k,sortedIDX)
% mySMOTE Synthetic Minority Oversampling Technique. A technique to
% generate synthetic samples as given in: https://www.jair.org/media/953/live-953-2037-jair.pdf
% Usage:
% X_smote = mySMOTE(X, N, k)
%
% Inputs:
% allData: Original dataset
% k: number of nearest neighbors to consider while performing
% augmentation
% sortedIDX: sorted labels
%
% Outputs:
% X_smote: augmented dataset containing original data as well.
%
% See also datasample, randsample
%% plot the bar plot for number of classes
figure
barh(sortedIDX);
ylabel('number of classes-->')
xlabel('Sampels in each class-->')
title('Original imbalance data distirbution')
%% number of each classes
labels=allData(:,end);
class=unique(sortedIDX);
for ii=1:numel(class)
classNo(ii)=numel(find(labels==class(ii)));
end
%% required addon samples in each minority class
%add on samples will be calculated by taking the difference of each
%classSamples with highest number of class samples
[maximumSamples,sampleClass]=max(classNo); % number of maximum samples
for ii=1:numel(class)
samplediff(ii)=maximumSamples-classNo(ii);
N (ii) = ceil(samplediff(ii)/ 100);
end
%% oversample the minority classes
allData_smote=[];
for ii=1:numel(class)
X=allData(labels==class(ii),:);
T = size(X, 1);
X_smote = X;
for i = 1:T
y = X(i,:);
% find k-nearest samples
[idx, ~] = knnsearch(X,y,'k',k);
% retain only N out of k nearest samples
idx = datasample(idx, N(ii));
x_nearest = X(idx,:);
x_syn = bsxfun(@plus, bsxfun(@times, bsxfun(@minus,x_nearest,y), rand(N(ii),1)), y);
X_smote = cat(1, X_smote, x_syn);
end
allData_smote=cat(1,allData_smote,X_smote);
end
%%
balanced_sortedIDX=allData_smote(:,end);
figure
barh(balanced_sortedIDX);
ylabel('number of classes-->')
xlabel('Sampels in each class-->')
title('Balanced data distirbution')
%% randomize the data
shuffleindex=randperm(size(allData_smote,1));
allData_smote=allData_smote(shuffleindex,:);
endHaleema Ahsanhttps://ww2.mathworks.cn/matlabcentral/profile/authors/16091120-haleema-ahsantag:ww2.mathworks.cn,2005:Question/5582652020-07-02T09:46:07Z2020-07-03T13:08:05ZError in using ode23t to solve a differential equation on a graph/networkHi, I am trying to solve a differential equation about a substance spreading on a graph/network.
I am using the ode23t solver, but I am getting the following errors:
Error using odearguments (line 113)
Inputs must be floats, namely single or double.
Error in ode23t (line 143)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in fr_net (line 48)
[T,H] = ode23t(@(t,h) MYODE(t,h,G,N,e,n,z,initialnode,w,Q,lambda),tspan,h,opts);
Do you have any idea how to fix it?
Here following, I tried to summarise the relevant parts of the code:
% network
s = [1 1 2 2 3 3 4 5 5 6 6 7 7 8 9 9 10 10 11 11 12 13 14 15];
t = [2 5 3 6 4 7 8 6 9 7 10 8 11 12 10 13 11 14 12 15 16 14 15 16];
G = graph(s,t);
N = numnodes(G); % 16 nodes
e = table2array(G.Edges);
n = table2array(G.Nodes);
% networks coordinates (x,y,z)
x = ...
y = ...
z = ...
G.Nodes.X = x'; G.Nodes.Y = y'; G.Nodes.Z = z';
% inputs/initial conditions/parameters
initialnode = 1;
h = repelem(0.01,N); % substance's amount for every node
h(initialnode) = 0.5; % substance's amount in node 1
w = repelem(1,N); % edge width
Q(initialnode) = 0; % substance rate in node 1
lambda = 0.3;
% ode23t solver
tspan = [0 3600]; % t = time
opts = odeset('MaxStep',3600);
[T,H] = ode23t(@(t,h) MYODE(t,h,G,N,e,n,z,initialnode,w,Q,lambda),tspan,h,opts);
% MYODE
function dhdt = MYODE(t,h,G,N,e,n,z,initialnode,w,Q,lambda),tspan,h,opts);
% the following loop is calculating some equation between i-node and j-node
for i = 1 : N
j = randi([1 N]);
% some operation/equation (I use cells for Q, since it could "store" several numbers)
Qcell{i} = ... % some operation/equation
dhdt_tmp{i} = cell2mat(Qcell{i}) - cell2mat(Qcell{j}) / distance_ij; % differential equation
end
dhdt = cell2mat(dhdt_tmp);
endSimhttps://ww2.mathworks.cn/matlabcentral/profile/authors/14233052-simtag:ww2.mathworks.cn,2005:Question/5589382020-07-03T11:16:26Z2020-07-03T13:06:34Zdiameter of image (1024x1024 logical value)Hello I have a 104x1024 logical.
when i use imshow(figure) to display it, it looks something like this
how do i get the diameter calculated?
i had already thought about the area but i don't know how.
this is an edited polar plot image
Thanks a lotprrrrrhttps://ww2.mathworks.cn/matlabcentral/profile/authors/4892021-prrrrrtag:ww2.mathworks.cn,2005:Question/5588602020-07-03T07:19:59Z2020-07-03T13:03:37ZHow i can change significant digit in App Designer UITable ?I have problem in changing significant digit on App designer.
Below here, there's my actual data.
1 0 0
2 2.50129E-005 -2.96795E-005
3 5.00021E-005 -3.8927
4 7.50025E-005 -34.6731
But, I got undesirable digits when i put this data into UITable in App desinger,
I tryied using "format shortEng" but, it works only in command window.
Sang Hyeok Yanghttps://ww2.mathworks.cn/matlabcentral/profile/authors/17902744-sang-hyeok-yangtag:ww2.mathworks.cn,2005:Question/2587952015-12-03T22:28:15Z2020-07-03T13:01:53Zhow can i replace white pixel (in binary image) with a color pixel of another image?i have two images , an RGB image(rgbimage) and it's binary image(b), i wanna know how to replace white pixel in (b) with an RGB pixel at same position as the position of RGB image.
i tried this code:
close all;
clear all;
clc;
rgbimage=imread('RGBimage.jpg');
whos rgbimage
b=imread('foreg.jpg');
whos b
[m n]=size(b)
for i=1:n
for j=1:m
if (b(i,j)==0)
b(i,j)=rgbimage(i,j)
end
end
end
imshow(b)bay remhttps://ww2.mathworks.cn/matlabcentral/profile/authors/7360022-bay-remtag:ww2.mathworks.cn,2005:Question/5589592020-07-03T11:50:42Z2020-07-03T12:58:18ZSize of Mini-Batch in deep learning Hi,
I am trying to train some deep learning models and trying to set up good value for the Mini-Batch. As you may know, the value of the Mini-Batch should be between 1 and M where M is the size of the batch.
My question is, once I extracted some training features and prepare the data for training. How can I tell the size of my batch so I can set the Mini-Batch?
Thanks Ibrahim Ahttps://ww2.mathworks.cn/matlabcentral/profile/authors/13498152-ibrahim-atag:ww2.mathworks.cn,2005:Question/5584392020-07-02T13:13:24Z2020-07-03T12:55:09ZMonth as a two digit numberI have
month(Date);
this will give me the number 1,2,3,...
But I want to have 01,02,03,.. as months. Please advise. alpedhuezhttps://ww2.mathworks.cn/matlabcentral/profile/authors/10930090-alpedhueztag:ww2.mathworks.cn,2005:Question/5575992020-07-01T07:59:09Z2020-07-03T12:54:00ZAdding two linear inequality constraints in Optimization toolbox I have the following code for maximizing revenue for a plant:
function varargout = EbsOptimize5_3(para)
para = reshape(para, 2, []);
% para = [x11,x12,x13;x21,x22,x23];
%para = reshape(para, 2, []);
global asmInfo app oc model objects Sun SunDNI SunDNImeasm M1 M2 M1measm M2measm TotalmassFlow;
if (~(size(asmInfo)))
disp('call EbsOpen.dll')
asmInfo = NET.addAssembly('C:\Program Files\Ebsilon\EBSILONProfessional 14 P3\EbsOpen.dll');
app = EbsOpen.ApplicationClass;
oc = app.ObjectCaster;
model = app.Open('C:\Users\Hassan Bukhari\Desktop\Priority Study\New EXP CSP 3_with_TimeSeries.ebs');
model.ActivateProfile('Charging');
objects = model.Objects;
%%%%%%%%%%%%
Sun = oc.CastToComp117(objects.Item('Sun'));
SunDNI = Sun.DNI;
%SunDNImeasm = Sun.DNI.Value;
M1 = oc.CastToComp33(objects.Item('Start_value_4'));
M2 = oc.CastToComp33(objects.Item('Start_value_5'));
M1measm = M1.M;
M2measm = M2.M;
end
SunDNImeasm = [600; 700];
powerPrice = [100; 150];
Power = zeros(1,length(SunDNImeasm));
Revenue = zeros(1,length(SunDNImeasm));
M1v = zeros(1,length(SunDNImeasm));
M2v = zeros(1,length(SunDNImeasm));
massFlow = zeros(1,length(SunDNImeasm));
for i=1:length(SunDNImeasm)
Sun.DNI.Value = SunDNImeasm(i);
M1measm.Value = para(1,i);
M2measm.Value = para(2,i);
errors = app.NewCalculationErrors();
model.Simulate(errors);
Gen = oc.CastToComp11(objects.Item('Generator'));
%Power = (Gen.QREAL.Value);
Power(i) = Gen.QREAL.Value/1000 ;
M1v(i) = M1measm.Value;
M2v(i) = M2measm.Value;
massFlow(i) = 3600*(M1v(i)+M2v(i));
Revenue(i) = -(Power(i)*powerPrice(i));
end
TotalRevenue = sum(Revenue);
TotalmassFlow = sum(massFlow);
varargout{1} = TotalRevenue;
if nargout > 1
varargout{2} = Power;
varargout{3} = Revenue;
varargout{4} = TotalmassFlow;
varargout{5} = M1v;
varargout{6} = M2v;
end
%TotalPower = sum(Power);
%TotalRevenue = Power*powerPrice;
%TotalRevenue = sum(Revenue);% Aineq=-ones(1,nvars);
% bineq=-9.36e3/3600;
end
I have added a linear inquality constraint on total mass flow as:
If I want to add another constraint on "Power" being calculated by the black box model attached to MATLAB, how can I do that?
Hussain Jahttps://ww2.mathworks.cn/matlabcentral/profile/authors/4971894-hussain-jatag:ww2.mathworks.cn,2005:Question/1111312013-12-31T16:55:58Z2020-07-03T12:52:46ZHow to fill the region of interest by white color Hi All,
I have this Black and white mask
<</matlabcentral/answers/uploaded_files/6364/4_400_before.png>>
I want to fill the region of interest to be like this
<</matlabcentral/answers/uploaded_files/6365/4_400_after.png>>
approximatlly by white color to use it for segmentation later,please any could help by a Matlab code to do this job,thanks in advance. hamed abdulazizhttps://ww2.mathworks.cn/matlabcentral/profile/authors/4484950-hamed-abdulaziztag:ww2.mathworks.cn,2005:Question/5586532020-07-02T19:51:25Z2020-07-03T12:51:59ZChange zeros to Nans only at a certain page in a 3D matrixI have a 3D matrix and I`m ttrying to change the zero elements of a certain page (let`s say the third one) to a NaNs. Can someone please help me? That one liner does not work.....
>> data(:,:,3)(data(:,:,3)==0)=NaN;chthttps://ww2.mathworks.cn/matlabcentral/profile/authors/10256908-chttag:ww2.mathworks.cn,2005:Question/5589742020-07-03T04:00:00Z2020-07-03T12:48:03ZWhy am I unable to use "rosinit" on a machine with a purely numeric name in MATLAB R2020a?I am working on an Ubuntu 16.04 machine. The machine has a purely numeric hostname, for example: 707406378. If I try to use "rosinit" on this machine in MATLAB R2020a, this throws a warning and error and fails to complete successfully:
Warning: The IP address 42.42.42.42 in the "NodeHost" setting is not associated with any network interface.
It is possible that MATLAB cannot be reached by other ROS nodes.
> In ros.internal/Net/generateNodeHost (line 368)
In ros/Node/parseArguments (line 313)
In rosinit (line 92)
The ROS master is already running on port 11311. Try connecting to this master or creating a new ROS master
that uses a different port.
MathWorks Support Teamhttps://ww2.mathworks.cn/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:ww2.mathworks.cn,2005:Question/5562522020-06-28T22:28:24Z2020-07-03T12:45:11ZPlotting GPS Coordinates over timeI have a flight test data set that includes the basic parameters of Altitude, Latitude, and Longitude recorded over a set period of time. What I'd like to be able to do is to generate a plot of the 3 position data points for a subset of the time period. As an example, I flew many approaches into different airports but I only want to look at the GPS data for 1 of those approaches at a specific airport. Without going through and parsing the basic MS Excel file that houses the data, is there a way to generate this plot in 2D and/or 3D?James Gilsonhttps://ww2.mathworks.cn/matlabcentral/profile/authors/9377413-james-gilsontag:ww2.mathworks.cn,2005:Question/4050182018-06-11T07:57:49Z2020-07-03T12:44:53Zwhy it always apears “Address already in use: Cannot bind”？ x=udp('192.168.2.20',166, 'LocalPort', 5030);
x.inputbuffersize=414720;
fopen(x);
fwrite(x,'get');
data=fread(x);
fclose(x);Qingying Tuhttps://ww2.mathworks.cn/matlabcentral/profile/authors/12932216-qingying-tutag:ww2.mathworks.cn,2005:Question/5584992020-07-02T14:55:26Z2020-07-03T12:33:45ZMatlab to excel and back! Q about using ActiveXCan anyone direct me to a website or a manual or a tutorial that will help explain how to use ActiveX to control how data are displayed in an excel file (e.g. number format, font size, etc)? And that shows simple examples. Yes, I've read many previous such quierries and the suggestions to read the MatLab documentation. But frankly, I find those exremely confusing and not helpful for someone at my relatively beginning stage. The documentation often uses jargon and unfamiliar terms.
I've generated a Table of data with a MatLab script and have written this to an excel file using xlswrite and writetable. That works fine!
Now, however, I want to be able to change the number formats and fonts in some of the excel rows.
Any ideas where best to learn how to manipulate excel files using MatLab and ActiveX?Stephenhttps://ww2.mathworks.cn/matlabcentral/profile/authors/4676522-stephen