Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Faster Matlab Table Creation

I've noticed that creating fairly large tables in Matlab (>10,000 rows) can be quite slow because of a single function called by the constructor, checkDuplicateNames. However, I commonly am sure that the names I'm passing the table are already unique.

The following illustrates the problem well. Generating 10,000 random values takes less than a millisecond but generating a table of random values with string row names takes a second and a half with 1.4 second taken by checking for duplicate row names:

profile on; 
a = rand(10000,1);
strind = cellstr(num2str((1:10000)'));
b = table(a, 'RowNames', strind); 
profile viewer

I'm curious then, is there an alternate way to create tables in Matlab without calling the checkDuplicateNames function?

like image 938
David Kelley Avatar asked Feb 18 '26 20:02

David Kelley


1 Answers

Based on this reply from a MathWorks employee, you can't do it without altering the core Matlab files.

like image 150
David Kelley Avatar answered Feb 21 '26 14:02

David Kelley