Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8825409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:52:17+00:00 2026-06-14T06:52:17+00:00

With the following code I’ve added variables into the base workspace: function data_startup() bdclose

  • 0

With the following code I’ve added variables into the base workspace:

function data_startup()
bdclose all;
data=load(fullfile('B', 'C', 'data.mat')); 
file_variables=fieldnames(data);% get the field names as cell array
for ii=1:length(file_variables)
     assignin('base', file_variables{ii}, data.(file_variables{ii}));
end

Now, I would like to clear variables from the base workspace, I’ve tried :

evalin('base','clear file_variables');

But this is not working 🙁

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T06:52:19+00:00Added an answer on June 14, 2026 at 6:52 am

    You’re trying to clear the variable with name file_variables, which probably doesn’t exist. What you want is:

    evalin('base',['clear' sprintf(' %s',file_variables{:})]);
    

    If you want to understand what’s going on: run and debug this line in your function, then inspect the outcome of

    ['clear' sprintf(' %s',file_variables{:})]
    

    which will be the command run by evalin.

    More info:

    [a b c] concatenates the strings in a,b and c, because the strings themselves are 1xN arrays.
    {:} returns the cell array as a comma separated list which is then inputted to sprintf, more info on this here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Following code iterates through many data-rows, calcs some score per row and then sorts
following code works perfectly on FF and Chrome but not in IE8. $(window).keyup(function(e) {
Following code I can use for storing the value of UILabel into a string.
Following code is an example of text placed into a textarea from a database.
following code work fine but 1 error $(document).ready( function() { $(#myCheckboxes input[type='checkbox']).change(function() { var
Following code is used to insert data in the database. When application is launched,
Following code has been picked up from this blog function! Privatize() let priorMethod =
Following code, credit: Guffa. Hello All, I'm trying to add controls to a Form
Following code fails with a error message : t.cpp: In function `void test()': t.cpp:35:
Following code is intended to restrict selection of today's date in datepicker. jQuery(function ()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.