Community Profile

# Peter Perkins

### MathWorks

Last seen: 15 dagar ago Active since 2011

All

#### Content Feed

View by

Using date and time in MATLAB
I'm having trouble following exactly what needs to be done, but I imagine you want to append variables to your LoadProfile&Tarif...

17 dagar ago | 1

| accepted

Help Merge two tables by the column variables
See join (or maybe innerjoin).

20 dagar ago | 1

| accepted

generate an independent seed with a fixed number
Ebru, you are doing parallel simulations and presumably want to combine the results under the assumption that those results are ...

20 dagar ago | 3

| accepted

Export rows as combined separate CSV files
There are a bunch of ways to do this. I thought I'd see how well rowfun works: > C = {rand(10,1) rand(10,1); rand(10,1) rand(10...

20 dagar ago | 0

Error: Row index exceeds table dimensions.
SOLARL.Date2 = datenum(SOLARL.Date); DON'T do that. Just use datetime. You can call unique, length, and == a on datetime vector...

21 dagar ago | 0

Elementwise calculations when making a new Table column
Will noone think of the joins? "I am trying to find (value1-min)/(max-min) using the appropriate max and min for the protocol ...

21 dagar ago | 0

unstack table with pre and post measurements
unstack needs you to tell it three things: 1) which variables to unstack. It looks like you want SystemWeight, JumpHeight, ... ...

21 dagar ago | 0

How to grab the first instance of a timestamp based on the second
It's a one-liner using a timetable and retime, with NewTimeStep 'secondly' and Method 'firstValue': >> tt = timetable(rand(10,1...

23 dagar ago | 0

| accepted

how can I calculate movmean from 1 periode wave data?
In addition to what Mathieu suggests, there are similar things shown in these examples, especially the first one: https://www.m...

23 dagar ago | 0

How to compare 2 columns line by line between two matrix of different size?
ismember will work, but ithis is a join operation. It's a one-liner: >> matrix1 = readtable('datasetPDP.csv'); >> matrix2 = re...

23 dagar ago | 0

| accepted

averaging columns in a table based on two other columns
This should be straight-forward using either groupsummary, or varfun with displacement_pixel as the input/data variable and x_pi...

23 dagar ago | 0

How do I make an array from select points in a large table (based on dates)?
Alex, you already have a timetable, which is the right thing to use. To help get you started: >> i = isbetween(timeofday(UMR202...

24 dagar ago | 0

| accepted

How to reformat this table's information so that a column of data becomes the header's for matching data?
I guess this is a useful format? Voss shows one way, here's another: >> Items = "Item" + (1:8)'; >> Family = "Family" + [1;2;4...

24 dagar ago | 1

Import and export excel data having combined number and text in a single cell.
If each cell of your spreadsheet literally contains things like "4-sample1-sample2-(23.56,-13.54)", then you may want to figure ...

24 dagar ago | 0

Stacked plots: display two variables on the same x-axis
Farbod, IIUC, you cannot do that with stackedplot. Each subplot can have only one y axis. The whole point of stackedplot is to a...

24 dagar ago | 0

retrieve data specific date
In addition to what KSSV shows, since you say "retrieve data", I recommend that you use a timetable, and things like timerange,o...

24 dagar ago | 0

Outerjoin does not merge the keys
As Kevin implies, your are using all four variables in smalltable as keys. That makes no sense. On top of that, there are NO com...

24 dagar ago | 0

Combination of two signals with different sample rates
Use a timetable, and call synchronize. synchronize uses interp1, but it may be that you particularly want to use the SP-oriented...

24 dagar ago | 0

Problem in determining standard error and plotting 3 error bars
Zhou, independently from how to make the figure, this code Data = table2array(WORK01S1); % convert it into array Temp = ...

24 dagar ago | 1

Select best time in an array
You are making your life more difficult using fopen etc. Use writetable and readtable: >> laptimes = readtable("laptimes.txt","...

24 dagar ago | 1

| accepted

tic/toc versus time.perf_counter_ns()
The doc doesn't say you can't use tic/toc to time very short things, and clearly that is not true: >> tic, x = 1; toc Elapsed ...

24 dagar ago | 0

How to extract time series averaged over a region?
Keegan, there's a bunch of ways to do this, here's one that uses a timetable: >> lat = ncread("chl2020.nc","latitude"); >> lon...

ungefär 2 månader ago | 0

| accepted

How can I merge successive row values (sum of the values) of the column Y according to a condition in column X?
You want to do grouped sums, where the groups are defined by consecutive zeros in X. Once you have the groups defined as a new v...

ungefär 2 månader ago | 0

Stackedplot: Incorrect x-axis values & multi-variable usage
Jackson, you have a table, and while stackedplot knows to plot against time with a timetable, it can't know what to plot against...

| accepted

How to do interpolation only if data interval is > than 3h?
StarStrider's suggestion of datetime and retime is the way to go. Also, like SS, I am mostly guessing at what you are asking for...

| accepted

readtable decide which coloumns are read as string and which as number. xlsx file
Magnus, detectImportOptions and subsequent modifications on what it returns are what you are looking for. You can set any or all...

How do I load only part of a table saved to a .mat file?
You might look into using datastores, which would, in effect, allow you to load pieces.

Rachael, the times are not part of the data, they are "metadata". But as your screenshot shows, the row times of the Acceleratio...