Is it possible to save the output of a command as a variable?
3 views (last 30 days)
Show older comments
If have data in PDF format, is it possible to use the file name as the variable name for the table created from the extracted data? I need to extract data from many files (Test1-100) so I am trying to automate part of the process so I can aggregate the information.
file = 'Test1.pdf';
[pathstr, TestNumber, ext] = fileparts(file);
str = extractFileText(file);
numbers = extractBetween(str, 'Start', 'Stop')
x = str2num(extractBetween(numbers, '0', '10'));
y = str2num(extractBetween(numbers, '11,' '20'));
table = array2table([x;y], 'VariableNames', {'Area 1', 'Area2'})
What syntax do I use to make "Test1" the variable name of the table??
Accepted Answer
Fangjun Jiang
on 13 Jan 2022
Edited: Fangjun Jiang
on 13 Jan 2022
VarName='Test1';
assignin('base',VarName,table)
2 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!