Applying a function only to certain rows in a table, marked by the start of the name.
3 views (last 30 days)
Show older comments
Hi and Hello,
I am currently working on a big set of data that is saved in a table.
The First collum is the Name of the Individual rows like "AB12_345678", AC12_345678
The rest of the collums contain different values. (doubles and numbers)
I am trying to figure out how to apply a function like mean or max only to those rows, thats name start with e.g "AB1".
I had no success with substrings, startsWith or rowfunc.
I am truly lost on how to do this since i want to avoid selecting the data by hand and running the code like 75 times.
Any and all help would be appreaciated.
Thanks in advance!
0 Comments
Accepted Answer
Saurabh
on 6 Jun 2023
you can use the startsWith function from the Text Analytics Toolbox to select the rows of a table whose name starts with a certain keyword.
And then accordingly You can access the rest of the values if you have the idices of the Table, thats name start with e.g "AB1".
Let me Know if this works.
startStr = "AB1";
idx = startsWith(string(file_name.PropertyName), startStr);
2 Comments
More Answers (0)
See Also
Categories
Find more on LaTeX in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!