Email: helpdesk@telkomuniversity.ac.id

This Portal for internal use only!

  • My Download
  • Checkout
Application Package Repository Telkom University
All Categories

All Categories

  • Visual Paradigm
  • IBM
  • Adobe
  • Google
  • Matlab
  • Microsoft
    • Microsoft Apps
    • Analytics
    • AI + Machine Learning
    • Compute
    • Database
    • Developer Tools
    • Internet Of Things
    • Learning Services
    • Middleware System
    • Networking
    • Operating System
    • Productivity Tools
    • Security
    • VLS
      • Office
      • Windows
  • Opensource
  • Wordpress
    • Plugin WP
    • Themes WP
  • Others

Search

0 Wishlist

Cart

Categories
  • Microsoft
    • Microsoft Apps
    • Office
    • Operating System
    • VLS
    • Developer Tools
    • Productivity Tools
    • Database
    • AI + Machine Learning
    • Middleware System
    • Learning Services
    • Analytics
    • Networking
    • Compute
    • Security
    • Internet Of Things
  • Adobe
  • Matlab
  • Google
  • Visual Paradigm
  • WordPress
    • Plugin WP
    • Themes WP
  • Opensource
  • Others
More Categories Less Categories
  • Get Pack
    • Product Category
    • Simple Product
    • Grouped Product
    • Variable Product
    • External Product
  • My Account
    • Download
    • Cart
    • Checkout
    • Login
  • About Us
    • Contact
    • Forum
    • Frequently Questions
    • Privacy Policy
  • Forum
    • News
      • Category
      • News Tag

iconTicket Service Desk

  • My Download
  • Checkout
Application Package Repository Telkom University
All Categories

All Categories

  • Visual Paradigm
  • IBM
  • Adobe
  • Google
  • Matlab
  • Microsoft
    • Microsoft Apps
    • Analytics
    • AI + Machine Learning
    • Compute
    • Database
    • Developer Tools
    • Internet Of Things
    • Learning Services
    • Middleware System
    • Networking
    • Operating System
    • Productivity Tools
    • Security
    • VLS
      • Office
      • Windows
  • Opensource
  • Wordpress
    • Plugin WP
    • Themes WP
  • Others

Search

0 Wishlist

Cart

Menu
  • Home
    • Download Application Package Repository Telkom University
    • Application Package Repository Telkom University
    • Download Official License Telkom University
    • Download Installer Application Pack
    • Product Category
    • Simple Product
    • Grouped Product
    • Variable Product
    • External Product
  • All Pack
    • Microsoft
      • Operating System
      • Productivity Tools
      • Developer Tools
      • Database
      • AI + Machine Learning
      • Middleware System
      • Networking
      • Compute
      • Security
      • Analytics
      • Internet Of Things
      • Learning Services
    • Microsoft Apps
      • VLS
    • Adobe
    • Matlab
    • WordPress
      • Themes WP
      • Plugin WP
    • Google
    • Opensource
    • Others
  • My account
    • Download
    • Get Pack
    • Cart
    • Checkout
  • News
    • Category
    • News Tag
  • Forum
  • About Us
    • Privacy Policy
    • Frequently Questions
    • Contact
Home/Matlab/Is there a way to save the filename used in a live script Import Data task?

Is there a way to save the filename used in a live script Import Data task?

PuTI / 2025-02-04
Is there a way to save the filename used in a live script Import Data task?
Matlab News

I am new to live scripts and although the streamlined functionality seems like a real time-saver it also obfuscates how some of the functions are working. The data processing activity that I am currently working on is quite straightfoward; choose CSV file from whatever is available in the working folder, import the data and structure it to be processed, prompt user to set the range of interest using sliders (which is an awesome feature that saves having to sanitize my data before import), then process and plot the result. Everything works great, but I can’t figure out how to use the filename of what is being imported as a variable…
In the past, before I was exposed to live scripts and the built-in tasks, I just wrote my code to have a commented line for the user to enter the filename which meant I could chop that filename up into useful pieces assuming it was named accordingly (for example: serialnumber_testnumber_operator.csv). Having that nicely structured filename allowed me to batch process any arbitrary number of data sets from a folder and spit out plots that were named for each data file (think "Y vs X, SN011 Test 3") which was great.
Setting my code up as a live script and changing the view to "hide code" makes a beatifully simple screen that I can turn over to people who don’t know anything about MATLAB for them to process data without my involvement, but I need that filename variable so that I can get the plots saved properly with their descriptive names. I’ve been sort of beating my head against the wall here trying to figure out how to do that, so I figured I should try asking for help.
Here’s the trail of breadcrumbs that I have followed so far starting within the code that exists in the Import Data task:
From this block:
% Import the data
rawdata = readtable("filepathfilename.csv")
If I step into the readtable function it goes straight into the ImportOptions function to line 496:
function T = readtable(filename,opts,varargin)
if ~isa(opts,’matlab.io.ImportOptions’)
error(message(‘MATLAB:textio:io:OptsSecondArg’,’readtable’))
end
try
func = matlab.io.internal.functions.FunctionStore.getFunctionByName(‘readtableWithImportOptions’);
T = func.validateAndExecute(filename,opts,varargin{:});
catch ME
throw(ME);
end
end

During that time the filename exists as a variable, but as soon as it steps out of the ImportOptions block filename disappears. If anyone can help me understand how to save that variable, it would be greatly appreciated.I am new to live scripts and although the streamlined functionality seems like a real time-saver it also obfuscates how some of the functions are working. The data processing activity that I am currently working on is quite straightfoward; choose CSV file from whatever is available in the working folder, import the data and structure it to be processed, prompt user to set the range of interest using sliders (which is an awesome feature that saves having to sanitize my data before import), then process and plot the result. Everything works great, but I can’t figure out how to use the filename of what is being imported as a variable…
In the past, before I was exposed to live scripts and the built-in tasks, I just wrote my code to have a commented line for the user to enter the filename which meant I could chop that filename up into useful pieces assuming it was named accordingly (for example: serialnumber_testnumber_operator.csv). Having that nicely structured filename allowed me to batch process any arbitrary number of data sets from a folder and spit out plots that were named for each data file (think "Y vs X, SN011 Test 3") which was great.
Setting my code up as a live script and changing the view to "hide code" makes a beatifully simple screen that I can turn over to people who don’t know anything about MATLAB for them to process data without my involvement, but I need that filename variable so that I can get the plots saved properly with their descriptive names. I’ve been sort of beating my head against the wall here trying to figure out how to do that, so I figured I should try asking for help.
Here’s the trail of breadcrumbs that I have followed so far starting within the code that exists in the Import Data task:
From this block:
% Import the data
rawdata = readtable("filepathfilename.csv")
If I step into the readtable function it goes straight into the ImportOptions function to line 496:
function T = readtable(filename,opts,varargin)
if ~isa(opts,’matlab.io.ImportOptions’)
error(message(‘MATLAB:textio:io:OptsSecondArg’,’readtable’))
end
try
func = matlab.io.internal.functions.FunctionStore.getFunctionByName(‘readtableWithImportOptions’);
T = func.validateAndExecute(filename,opts,varargin{:});
catch ME
throw(ME);
end
end

During that time the filename exists as a variable, but as soon as it steps out of the ImportOptions block filename disappears. If anyone can help me understand how to save that variable, it would be greatly appreciated. I am new to live scripts and although the streamlined functionality seems like a real time-saver it also obfuscates how some of the functions are working. The data processing activity that I am currently working on is quite straightfoward; choose CSV file from whatever is available in the working folder, import the data and structure it to be processed, prompt user to set the range of interest using sliders (which is an awesome feature that saves having to sanitize my data before import), then process and plot the result. Everything works great, but I can’t figure out how to use the filename of what is being imported as a variable…
In the past, before I was exposed to live scripts and the built-in tasks, I just wrote my code to have a commented line for the user to enter the filename which meant I could chop that filename up into useful pieces assuming it was named accordingly (for example: serialnumber_testnumber_operator.csv). Having that nicely structured filename allowed me to batch process any arbitrary number of data sets from a folder and spit out plots that were named for each data file (think "Y vs X, SN011 Test 3") which was great.
Setting my code up as a live script and changing the view to "hide code" makes a beatifully simple screen that I can turn over to people who don’t know anything about MATLAB for them to process data without my involvement, but I need that filename variable so that I can get the plots saved properly with their descriptive names. I’ve been sort of beating my head against the wall here trying to figure out how to do that, so I figured I should try asking for help.
Here’s the trail of breadcrumbs that I have followed so far starting within the code that exists in the Import Data task:
From this block:
% Import the data
rawdata = readtable("filepathfilename.csv")
If I step into the readtable function it goes straight into the ImportOptions function to line 496:
function T = readtable(filename,opts,varargin)
if ~isa(opts,’matlab.io.ImportOptions’)
error(message(‘MATLAB:textio:io:OptsSecondArg’,’readtable’))
end
try
func = matlab.io.internal.functions.FunctionStore.getFunctionByName(‘readtableWithImportOptions’);
T = func.validateAndExecute(filename,opts,varargin{:});
catch ME
throw(ME);
end
end

During that time the filename exists as a variable, but as soon as it steps out of the ImportOptions block filename disappears. If anyone can help me understand how to save that variable, it would be greatly appreciated. live script, data import, filename MATLAB Answers — New Questions

​

Tags: matlab

Share this!

Related posts

Optimal decimation to Log Simulation Data
2025-05-18

Optimal decimation to Log Simulation Data

I need to use a scope to display the current i and the power P as functions of the voltage V, with the curves obtained for various irradiance levels and temperatures
2025-05-18

I need to use a scope to display the current i and the power P as functions of the voltage V, with the curves obtained for various irradiance levels and temperatures

Break in and break away points on Root Locus
2025-05-18

Break in and break away points on Root Locus

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Categories

  • Matlab
  • Microsoft
  • News
  • Other
Application Package Repository Telkom University

Tags

matlab microsoft opensources
Application Package Download License

Application Package Download License

Adobe
Google for Education
IBM
Matlab
Microsoft
Wordpress
Visual Paradigm
Opensource

Sign Up For Newsletters

Be the First to Know. Sign up for newsletter today

Application Package Repository Telkom University

Portal Application Package Repository Telkom University, for internal use only, empower civitas academica in study and research.

Information

  • Telkom University
  • About Us
  • Contact
  • Forum Discussion
  • FAQ
  • Helpdesk Ticket

Contact Us

  • Ask: Any question please read FAQ
  • Mail: helpdesk@telkomuniversity.ac.id
  • Call: +62 823-1994-9941
  • WA: +62 823-1994-9943
  • Site: Gedung Panambulai. Jl. Telekomunikasi

Copyright © Telkom University. All Rights Reserved. ch

  • FAQ
  • Privacy Policy
  • Term

This Application Package for internal Telkom University only (students and employee). Chiers... Dismiss