Community Profile

photo

Mohammad Sami


Last seen: Today
109 total contributions since 2014

Mohammad Sami's Badges

  • 3 Month Streak
  • Knowledgeable Level 3
  • Revival Level 1
  • First Answer
  • Speed Demon
  • Solver

View details...

Contributions in
View by

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

ungefär 8 timmar ago | 0

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

ungefär 10 timmar ago | 0

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

ungefär 13 timmar ago | 0

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

ungefär 13 timmar ago | 1

| accepted

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

3 dagar ago | 0

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

3 dagar ago | 1

| accepted

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

5 dagar ago | 0

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

6 dagar ago | 0

| accepted

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

7 dagar ago | 0

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

11 dagar ago | 0

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

11 dagar ago | 0

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

12 dagar ago | 0

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

14 dagar ago | 0

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

17 dagar ago | 0

| accepted

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

17 dagar ago | 0

Answered
Storing data in an array from a for loop
You don't need to read your file line by line. textscan can scan the entire file in one pass (unless the format spec keep changi...

17 dagar ago | 0

Answered
Use a wildcard to look for values in struct
Is there only one middle field ? If thats the case you can do as follows % s = your struct f = filednames(s); v = getfield(s...

18 dagar ago | 0

| accepted

Answered
How to input a specific data into Matlab Gui uitable via clicking a button?
The reason is because your second line of code overwrites your previous assignment. You need to specify the column in your code...

18 dagar ago | 1

| accepted

Answered
Find a specific set of values in a matrix
You can do this quite easily twocolmat = rand(100,2); idx = twocolmat(:,1) >= 0.2; col2vals = twocolmat(idx,2);

18 dagar ago | 2

Answered
How to use the fillmissing function to interpolate at certain points
You can directly use interp1 to interpolate at your desired time intervals. t = 1:100; v = zeros(1,100); % here v is the value...

18 dagar ago | 0

| accepted

Answered
Creation of a .dat files in a for loop
% assume some values mx_inelastic = rand(30001,2434); my_inelastic = rand(30001,2434); mz_inelastic = rand(30001,2434); phy...

19 dagar ago | 1

| accepted

Answered
How do I separate a data set into separate cell arrays according to the integer on the end of a string?
You need to extract the digit at the end. % c = yourcell array digit = regexp(c(:,4),'\d+$','match','once'); [u_d,i,j] = uniq...

19 dagar ago | 0

| accepted

Answered
Double summation in matlab
You can define a function to calculate the expression inside the brackets. a = @(p,param)param.^p./factorial(p); % (param^n)/fa...

26 dagar ago | 1

| accepted

Answered
Dividing cyclical data in array
Assuming you can get the locations of the peak, you can create an id variable. % acc = ... m x 1 array %locationidxofpeak = so...

ungefär en månad ago | 0

| accepted

Answered
Variable Depth Struct Field Reference
You can use the subsref function to index into the struct. You need to create the variable s dynamicall. To assign you can use ...

ungefär en månad ago | 0

Answered
Wait for a button to be pressed to continue the function - APP DESIGNER
Instead of a button, you can change it to a state button in app designer Then in your code just use a while loop to check the v...

ungefär en månad ago | 0

| accepted

Answered
How to compare pair of rows in a column and report it in hexadecimal format
data = rand(512,1); oddrows = data(1:2:end); evenrows = data(2:2:end); response1 = oddrows > evenrows; response2 = evenrows ...

ungefär en månad ago | 1

| accepted

Answered
changing continuous transfer function
You should just define your transfer function as a function. You can then just pass in the values you want to evaluate on. H = ...

ungefär 2 månader ago | 0

Answered
Storing data in a real time recording gui using a callback
Instead of concatenating the data with every iteration, just store the data in a cell array. You can concatenate it when you nee...

ungefär 2 månader ago | 0

| accepted

Answered
Read Time from the column of CSV file for plotting purpose
readtable should work just fine with your data. a = readtable('Moxy.csv'); plot(a.hh_mm_ss,a.SmO2Live)

ungefär 2 månader ago | 0

| accepted

Load more