Risposto
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...

circa 6 anni fa | 0

Risposto
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...

circa 6 anni fa | 0

Risposto
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...

circa 6 anni fa | 1

| accettato

Risposto
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])

circa 6 anni fa | 1

| accettato

Risposto
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...

circa 6 anni fa | 0

| accettato

Risposto
"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...

circa 6 anni fa | 0

| accettato

Risposto
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...

circa 6 anni fa | 1

| accettato

Risposto
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...

circa 6 anni fa | 0

Risposto
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...

circa 6 anni fa | 0

Risposto
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);

circa 6 anni fa | 0

Risposto
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; % ...

circa 6 anni fa | 1

| accettato

Risposto
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...

circa 6 anni fa | 0

| accettato

Risposto
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. ...

circa 6 anni fa | 0

| accettato

Risposto
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...

circa 6 anni fa | 1

Risposto
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.

circa 6 anni fa | 0

| accettato

Risposto
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...

circa 6 anni fa | 0

Risposto
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...

circa 6 anni fa | 1

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

circa 6 anni fa | 0

Risposto
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...

circa 6 anni fa | 1

| accettato

Risposto
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...

circa 6 anni fa | 0

Risposto
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...

circa 6 anni fa | 1

| accettato

Risposto
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...

circa 6 anni fa | 1

Risposto
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...

circa 6 anni fa | 0

| accettato

Risposto
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...

circa 6 anni fa | 0

Risposto
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...

circa 6 anni fa | 0

Risposto
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...

circa 6 anni fa | 0

Risposto
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 =...

circa 6 anni fa | 0

Risposto
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...

circa 6 anni fa | 0

Risposto
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((((...

circa 6 anni fa | 0

| accettato

Risposto
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...

circa 6 anni fa | 0

Carica altro