Community Profile

# Ameer Hamza

### Hong Kong Polytechnic University

2,572 total contributions since 2016

#### Ameer Hamza's Badges

View all

Contributions in
View by

Creating a conditional variable or function such that
Try this schoolID = [1001 1001 1005 1005 1018 1018 1018]; enrollment = [22 22 29 29 22 22 22]; grps = findgroups(schoolID)...

4 hours ago | 1

| accepted

Is matlab function distance is broken ?
You need mapping toolbox to use this function: https://www.mathworks.com/products/mapping.html

5 hours ago | 0

| accepted

How to know results
Your current code does not solve the problem, as you described. You need to use for-loop a=2, c=1, d=2 , g=0.5, k=2 , f=2 e=[...

1 day ago | 0

| accepted

load txt file in matrix into matlab
As Madhan mentioned that you might want to load it as symbolic, you may try str = fileread('test.txt'); words = regexp(str, '\...

1 day ago | 0

Problem with definite Integral
If you check at the expression of 'f', you can see it also has 't'. So even if you try to numerically integrate it w.r.t. 'r' an...

1 day ago | 0

| accepted

even distribution in Matlab
y = rescale(rand(1, 1000), 800, 1200)

1 day ago | 0

How can I update gauge value display during a function?
Use drawnow for i=1:100 app.Gage.Value=i; drawnow % code

1 day ago | 0

Problem with playing audio file from App Designer
I think you have named your own app "audioplayer". You can check it using which audioplayer If it shows the path your .mlapp f...

1 day ago | 0

| accepted

How to bypass empty fields in structure when loading data?
Use isstruct(): https://www.mathworks.com/help/releases/R2020a/matlab/ref/isstruct.html. For example, use the following if condi...

1 day ago | 0

How to publish symbolic matrices in latex format in MATLAB?
You may try Live scripts. It renders the symbolic matrices in mathematical notation and allows you to get latex code directly. F...

1 day ago | 0

Share function output within callback with another callback in App Designer
You can do so using properties. Switch to code view, and on the toolbar, click the "Property" button to add a new property to yo...

1 day ago | 1

How to plot 3 different data in contour or pcolor ?
p = pcolor(dt, nw_bin, sizdist) shading interp xlabel('x'); ylabel('y'); colorbar

1 day ago | 1

| accepted

How to extract data from simulink to work space in matlab?
Try "To workspace" block: https://www.mathworks.com/help/releases/R2020a/simulink/slref/toworkspace.html

2 days ago | 0

How to fit the data with 2 term power law function?
taking log() of the equation make it very easy to find the parameter (because the equation is linear in term of a and b). Try th...

2 days ago | 0

| accepted

How can I make variable value instead of constant one?
You need to use element-wise operators a = 1.27; b = 0.19 ; c = 0.44 ; d = 0.2 ; e = 300 ; f = 5*10^21 ; g = 2*10^23 ; h = 1.2 ...

2 days ago | 0

| accepted

Not effective validation algorithm for input format
Try this vx=zeros(1,4); vy=zeros(1,4); vertices=['A'; 'B'; 'C'; 'D']; fprintf('\nPlease enter the coordinates of vertices:\n...

2 days ago | 0

| accepted

Separating string element by two and creating a vector in Simulink
See the attached file (created in R2019b). The following image also shows the block needed to do the conversion.

2 days ago | 0

| accepted

Grouping the bar graph
Try this clear all clc training=5; sheetname='Result'; freezePercent = zeros(training, 10); for i=1:training freezePe...

2 days ago | 0

| accepted

Plot each image on the same figure. Use enough time increments so that the period of the largest frequency of oscillation has about 40 time increments per period
You can do something like this t = 0:0.001:10; y11 = 0.2763*cos(1.59*t) + 0.7237*cos(3.39t); y12 = % 1st equation for y2 y21...

3 days ago | 0

To smooth the 3D track by using low pass or sgolay filter.
Try this a = [0 9 10 9 8 7 6 4 2 -12 4 3 5 8 7 11 14 6 5 0 -4 -3 -15 -11 -9 -4 0]; b = [0 0 5 10 2 10 7 12 6 12 14 20 18 12 17...

3 days ago | 0

| accepted

hello everyone! I need to extract some data out of my table and I am facing the following problem. can anyone help?
Try this Pos = vertcat(F1.Position); f1 = Pos(:,1); f2 = Pos(:,2); f3 = Pos(:,3);

3 days ago | 0

| accepted

How to create an independent image after drawing a ROI
See exportgraphics(): https://www.mathworks.com/help/releases/R2020a/matlab/ref/exportgraphics.html [R2020a] saveas(): https://...

3 days ago | 1

| accepted

Operations in structure with N fields named sequencially.
Try this y = mean(structfun(@mean, s));

3 days ago | 0

| accepted

How to store strings in a matrix or table?
If the end goal is to write these values in excel, the following will work (R2019a and later) A = compose('a%d', reshape(1:12, ...

4 days ago | 1

| accepted

How to derive a response plot?
See this example sys = tf(1, [1 2 10]); [y, t] = impulse(sys); dy = gradient(y, t); plot(t, y, 'r', t, dy, 'b') legend({'y'...

4 days ago | 1

| accepted

Contour in a 3D surface plot
contour() object have an undocumented property named ContourZLevel: https://stackoverflow.com/a/8055468/4346708. For example, [...

4 days ago | 0

How to access elements of all field of structure in same loop
To access name filed, the following for-loop works for i =1:length(student) name{i} = student(i).name end However, for-l...

4 days ago | 0

how to assign same value according to each subgroup
Try this M = [ 11005 1 11005 2 11006 1 11006 2 11009 1 11010 ...

4 days ago | 0

| accepted

How to replace any number of repeating characters in a string or character array
Something like this str = fileread('test.txt'); new_str = regexprep(str, ':\.{2,}', ',') Result new_str = 'Riots, Tips ...

4 days ago | 0

| accepted