Respondida
Trying to extract numbers between bounds and counting them
If you can use logical vectors then you can do it like this x = randi(100,10,1); count = sum(x >= 60 & x < 70); If you have t...

casi 6 años hace | 0

Respondida
Replacing a whole row of a matrix with specific characters
a = char(randi([0 1],4000,5)+'0'); % create a n by 5 char array b = bin2dec(a); % convert it to decimal b(b>25) = b(b>25) - 'A...

casi 6 años hace | 0

Respondida
Converting cell array to matlab datetime format
we can replace the gmt with utc t = {'03.08.2003 23:00:00.000 GMT+0200'}; t = strrep(t,'GMT','UTC'); t = datetime(t,'InputFor...

casi 6 años hace | 1

| aceptada

Respondida
Assign mean and max value to a heatmap color bar
You can specify the color limits in your heat map %h = heatmap(__,'ColorLimits',[0 10])

casi 6 años hace | 1

| aceptada

Respondida
How to find and replace the content of an array
% sometimestamp = {'03/07/2019' '03/07/2019 00:30:00'}; l = cellfun(@length,sometimestamp); % or % l = strlength(sometimest...

casi 6 años hace | 0

| aceptada

Respondida
"Next Button" and "command window" in App Designer
Make an app and add two properties. Filelist and currentidx and a placeholder for image in the app. Make a function called load...

casi 6 años hace | 0

| aceptada

Respondida
How to assign the value to the min/max of a color map in heatmap?
You can flip the colormap summer to get your desired colorscheme. f = figure; a = heatmap(rand(10,10),'Parent',f); colormap(f...

casi 6 años hace | 1

| aceptada

Respondida
How to rotate and rescale a portion of a class images in an image datastore network ?
You can use the augmentedImageDataStore. It will randomly apply the specified agumentation to the images. https://www.mathworks...

casi 6 años hace | 0

Respondida
slow down the for loop operation for huge set of datas
You don't need to use the for loop with the inpolygon function. idx = inpolygon(X(:),Y(:),LocationsListData.x,LocationsListData...

casi 6 años hace | 0

Respondida
How to seperate an array into two?
You can directly index into your 1-D vector. V = rand(8,1); n = length(V); Vodd = V(1:2:n); Veven = V(2:2:n);

casi 6 años hace | 0

Respondida
I have an equation with 3 variables that each have an allowable range of values, how can I compute all possible solutions by picking from the allowable range of values at random?
B = 1.71E11; F = @(E,Q,K) E.*B + Q.* (B./K); mnE = 0.02; mxE = 0.06; numval = 100; E = rand(numval,1) .*(mxE-mnE) + mnE; % ...

casi 6 años hace | 1

| aceptada

Respondida
How to read and write to global variables of shared library(using loadlibrary)?
You need to get the pointer first. Try the following to see if it works. Also you did not specify what data type the pointer i...

casi 6 años hace | 0

| aceptada

Respondida
Bar chart with numerical x-axis treated as labels OR with thicker "bars"
categorical does not need you to supply the values as cellstring or string. You can straight away use it on a numerical array. ...

casi 6 años hace | 0

| aceptada

Respondida
Why my for loop does not work correctly?
for i = 1:numel(Class1_mon_avg_synop) j = (i-1)*2; ave(i) = Class1_mon_avg_synop{1,i}.sum_rrr24(i); ALLMONTHS_cla...

casi 6 años hace | 1

Respondida
How to create a menu with checkbox in app designer?
There is a property "Checked" for uimenu. In app designer select the menu and in property inspector tick the checked box.

casi 6 años hace | 0

| aceptada

Respondida
How to extract text from .json files and combine them?
You can import your data into cell arrays filelist = {}; vals = cell(length(filelist),1); haveabstract = false(length(filelis...

casi 6 años hace | 0

Respondida
How to calculate the highest consecutive negative results in my code
Assuming your vector is called a a = randi([-10 10],2000,1); ag0 = a>=0; % idx of val greater then a id = cumsum(ag0 | circsh...

casi 6 años hace | 1

Respondida
Data comparison and storing
Humidity = str2double(Humidity(~ismissing(Humiditiy))); lowlimit = 40; highlimit = 50; outsidelimit = Humidity > highlimit ||...

casi 6 años hace | 0

Respondida
Efficiently copying values from one table two another in which unique values are columns
C = unstack(B,'volatility','days'); The function unstack will do exactly what you are trying to do. The first column would be...

casi 6 años hace | 1

| aceptada

Respondida
Cannot create a pointer to a struct
You need to use the function libstruct https://www.mathworks.com/help/releases/R2020a/matlab/ref/libstruct.html https://www.ma...

casi 6 años hace | 0

Respondida
How to add multiple legends in app designer ?
Add a display name to each plot. then turn on the legends at the end % example ax = axes; hold(ax,'on'); for i = 1:10 p...

casi 6 años hace | 1

| aceptada

Respondida
Run a Python Script to Stream Data
You should split your code into two functions. You can create a python function that instantiates the socket and return the soc...

casi 6 años hace | 1

Respondida
Extracting repeated rows from table data based on conditions
% a = sometable, % assume no repeat of columns 6:7 for combination of 1:5 [b,ia,ic] = unique(a(:,1:5),'rows'); n = accumarra...

casi 6 años hace | 0

| aceptada

Respondida
Combine plots generated using for loop
Did you mean sub plots ? f = figure; tiledlayout(f,5,1); for i=1:5 ax = nexttile x = [0 : 0.01: 10]; y = i*sin...

casi 6 años hace | 0

Respondida
How to apply function on columns while skipping certain columns
m = rand(31413,950); allcols = 1:950; exccols = 1:10:950; applcols = allcols(~ismember(allcols,exccols)); out = max(m(:,appl...

casi 6 años hace | 0

Respondida
In MATLAB GUI, how can I display a set of elements such as edit text and slider only if I push the radiobutton?
If you are using app designer something like this will work for you. Essentially you can have an entire row or column of your g...

casi 6 años hace | 0

Respondida
Please help with using accumarray to choose the max value of the array
% matrix = 11 x 3 ch = matrix(:,1); [u,~,ic] = unique(ch); maxba = accumarray(ic,matrix(:,2),[],@max); out = [u maxba]; i =...

casi 6 años hace | 0

Respondida
Extract data from all values of a containers.Map collection
I assume that each of value in the container is a struct with identical fields. You can just get all the values like this % M...

casi 6 años hace | 0

Respondida
Hey, Im trying to run this code but the run time is too long. can anyone help me out here plz
As a starting point you can vectorize your inner for loops m = repelem(1:s(1),1,s(2)); n = repmat(1:s(2),1,s(1)); a = cos((((...

casi 6 años hace | 0

| aceptada

Respondida
How to insert y-coordinate into plot next to each point
total_num_attacks=[0,1,2,3,4,5]; attack_kill_array=[0,.2,.31,.39,.43,.46]; kill_chance_increase=[0,0,.38,.18,.1,.06]; max_att...

casi 6 años hace | 0

Cargar más