Community Profile

# Duncan Po

### MathWorks

93 total contributions since 2013

#### Duncan Po's Badges

View details...

Contributions in
View by

Rapid access and data manage of a table with cell array in the columns
You can use cellfun. For example, to compute the maximum of each column of the H3raw cell column for each row, do this: cellfun...

alrededor de 2 meses ago | 0

| accepted

Plotting Timetable in Matlab
The line: Time=TR({'05-05-2020','05-06-2020 00:00:00'},:); only extracts two rows from TR. So Time only has two rows. Then w...

alrededor de 2 meses ago | 0

Grouping based upon differences in time, with some small scatter
One way to do this is to use isbetween in a for loop, and then unique(, 'rows') to find the groups: t = datetime({'27-Aug-2020 ...

alrededor de 2 meses ago | 0

| accepted

How can I track time periods under certain criteria?
You can put your data in a timetable and then use movsum like this: tt = readtimetable('Daily_Data_Thessaloniki.xlsx'); tt.thr...

alrededor de 2 meses ago | 0

| accepted

PLOT ACTION IN TIME LAPS
Your data is best represented as a timetable in MATLAB. You can then use stackedplot to generate the visualization. haa = readt...

alrededor de 2 meses ago | 1

| accepted

Spatial correlations with a timeseries
corr works on columns in 2D matrices. Your local temperature is a row, so you need to tranpose it: local_temp = local_temp...

alrededor de 2 meses ago | 0

Combine timetables vertically different variables
You can use outerjoin with MergeKeys option set to true. You need to specify your common variable names (in addition to 'Time') ...

alrededor de 1 año ago | 1

| accepted

How to stackedplot with text data
What do you expect to see with your text data in the plot? stackedplot ignores text data, but plots categorical data. If your ...

más de 1 año ago | 0

What unit does the frequency have (MATLAB Color Histogram)?
The Y axis is number of pixels. The image in the example is 384x512, so it has 196608 pixels.

más de 1 año ago | 0

| accepted

Help with creating histogram
If you convert to categorical, you can sort the counts by descending order: a = randi(10,10,10); histogram(categorical(a), 'Di...

alrededor de 2 años ago | 0

| accepted

Is there a way to plot multiple graphs in one "subplot" of a stackedplot figure?
stackedplot can plot multiple lines in the same axes. One way is to have a non-column matrix as one of your table variables: x ...

alrededor de 2 años ago | 3

| accepted

I can't plot two lists as histograms as different colors on the same plot. Hist wants 'Numeric Input'
What does class(list1) return? If it returns anything other than a builtin numeric class, that would be the reason for your erro...

más de 3 años ago | 0

arrange multiple 2D histograms in 3D
You can use the hist function to plot one histogram, then grab its vertices from the resulting patch object. Pass these vertices...

casi 5 años ago | 1

how to extract subbands from pyramidal directional filter bank/contourlet decomposition of an image?
You need the contourlet toolbox: <http://www.mathworks.com/matlabcentral/fileexchange/8837-contourlet-toolbox>

casi 5 años ago | 0

Two bar graphs - two data sets - different bin width
histogram/histcounts have builtin support for Freedman-Diaconis rule: histogram(x, 'BinMethod', 'fd') or [n, binedges] ...

casi 5 años ago | 0

When brushing 3-d scatter, why does the marker not change?
Are you using R2014b? There is a bug in that version. Good news is it is fixed in 15a, so if you update, brushing on scatter3 wi...

casi 5 años ago | 1

| accepted

How to do sliding window operation in Matlab?
R2016a has a new function movsum: >> x=[4,1,1,1,2,2,3,5,9,7,7,7,6,6,1,1,2,3,4,4] >> movsum(x,10,'EndPoints','discard') ...

casi 5 años ago | 2

Splitapply, each data of group in a new figure/plot
You can do it but not with an anonymous function. You need a separate function to pass into splitapply: function myplot(dm,...

casi 5 años ago | 0

| accepted

Count numbers for occurrences
If you are using R2015b or later versions, you can use findgroups and splitapply: % Set up a table with pretend data use...

casi 5 años ago | 2

Solved

Rotate a Matrix by 90 degrees
Rotate a Matrix by 90 degrees Example: If the input is: X = 1 2 3 4 5 6 7 8 9 ...

alrededor de 8 años ago

Solved

Find the largest value in the 3D matrix
Given a 3D matrix, A, find the largest value. E.g. >> A = 1:9; >> A=reshape(A,[3 1 3]); >> islargest(A) ans = 9

alrededor de 8 años ago

Solved

Back to basics 10 - Max Float
Covering some basic topics I haven't seen elsewhere on Cody. Return the largest positive floating-point number MATLAB can han...

alrededor de 8 años ago

Solved

Subset Sum
Given a vector v of integers and an integer n, return the the indices of v (as a row vector in ascending order) that sum to n. I...

alrededor de 8 años ago

Solved

Project Euler: Problem 10, Sum of Primes
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below the input, N. Thank you <http:/...

alrededor de 8 años ago

Solved

Project Euler: Problem 7, Nth prime
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the Nth prime nu...

alrededor de 8 años ago

Solved

Bullseye Matrix
Given n (always odd), return output a that has concentric rings of the numbers 1 through (n+1)/2 around the center point. Exampl...

alrededor de 8 años ago

Solved

Sum of diagonal of a square matrix
If x = [1 2 4; 3 4 5; 5 6 7] then y should be the sum of the diagonals of the matrix y = 1 + 4 + 7 = 12

alrededor de 8 años ago

Solved

Remove NaN ?
input -> matrix (n*m) with at least one element equal to NaN; output -> matrix(p*m), the same matrix where we deleted the enti...

alrededor de 8 años ago

Solved

The Hitchhiker's Guide to MATLAB
Output logical "true" if the input is the answer to life, the universe and everything. Otherwise, output logical "false".

alrededor de 8 años ago

Solved

How to find the position of an element in a vector without using the find function
Write a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for. Examples: fin...

alrededor de 8 años ago