🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

How can i create a variable with a xlsx file so it can be read in a lookup table block?

User: "Tomás Glória"
New Altair Community Member
Updated by Tomás Glória

Hi, 

I am trying to convert a matlab-simulink projeto to activate but i dont know how i can create a variable with a xlsx file so it can be easly edited and read in a lookup table block. In matlab there´s the function xlsread() witch does that, bue i dont know how can i do it in activate. Can you help me?

 

Thank you, 

Tomás Glória.

Find more posts tagged with

Sort by:
1 - 9 of 91
    User: "RoKet"
    Altair Employee
    Updated by RoKet

    Hi Tomás,

    In Activate you also can use xlsread in Model or Diagram context, e. g.

    [mat, txt, raw] = xlsread([filepath filename], 1, 'A1:I60');

    Now you can access single cells

    mat(2, 5);

    or even rows and lines. The rows or lines can be used for input of lookup table data.

    For additional info please have a look at the help: xlsread.

    RoKet

    User: "Tomás Glória"
    New Altair Community Member
    OP
    Updated by Tomás Glória

    Hi Tomás,

    In Activate you also can use xlsread in Model or Diagram context, e. g.

    [mat, txt, raw] = xlsread([filepath filename], 1, 'A1:I60');

    Now you can access single cells

    mat(2, 5);

    or even rows and lines. The rows or lines can be used for input of lookup table data.

    For additional info please have a look at the help: xlsread.

    RoKet

    thank your for answer the question.

    I tried to make a super simples model and use xlsread in Model initialization but it doesnt recogniz it.

    image

    Do you have any idea why?

    User: "RoKet"
    Altair Employee
    Updated by RoKet

    Not really.

    xlsread is available both in Personal and Business Edition, I use 2021.2, but it has been supported for a long time.

    One limitation (according to help): xlsread is available only on Windows systems where Microsoft Excel is installed.

    Another quick check: if you also have Compose installed, you can try xlsread there. Both Activate and Compose use the same implementation of oml.

    User: "Tomás Glória"
    New Altair Community Member
    OP
    Updated by Tomás Glória

    Not really.

    xlsread is available both in Personal and Business Edition, I use 2021.2, but it has been supported for a long time.

    One limitation (according to help): xlsread is available only on Windows systems where Microsoft Excel is installed.

    Another quick check: if you also have Compose installed, you can try xlsread there. Both Activate and Compose use the same implementation of oml.

    Yes, i have Microsoft Excel installed and on compose it works, i just dont get it why it doesn´t in activate.

    Thank you for answering any way!

    User: "RoKet"
    Altair Employee
    Updated by RoKet

    Next try.

    1. I've created a very simple model with lookup table and xlsread in initialization as well as an Excel file. Please give it a try.

    2. If it fails, just call xlsread('pathandexcelfile') in OML Command Window.

    User: "Tomás Glória"
    New Altair Community Member
    OP
    Updated by Tomás Glória

    Next try.

    1. I've created a very simple model with lookup table and xlsread in initialization as well as an Excel file. Please give it a try.

    2. If it fails, just call xlsread('pathandexcelfile') in OML Command Window.

    I keeps sending the same error: image

    Although i noitice now when i open the Activate it sends an error immediately do you know what can it be?

     

    User: "RoKet"
    Altair Employee
    Updated by RoKet

    That was a good hint! Unfortunately, Activate can't handle special characters in the user path (and I assume not in other paths either).

    Can you change the user name (with impact on c:\users\username) or create another user to check it?

    User: "Tomás Glória"
    New Altair Community Member
    OP
    Updated by Tomás Glória

    That was a good hint! Unfortunately, Activate can't handle special characters in the user path (and I assume not in other paths either).

    Can you change the user name (with impact on c:\users\username) or create another user to check it?

    I tried to change the user folder name but i wasnt successful. However a friend of mine dont have any special character in  the user path and still have that some error ("xlsread is not defined").

    Sorry for taking so long to respond, had some really busy days.

    User: "RoKet"
    Altair Employee
    Updated by RoKet

    The main issue is a special character in user path resp. Activate's inability to process utf8. As a result, neither Activate_startup.oml nor some toolboxes (like xls-toolbox) can be loaded automatically. This will be fixed in the next release.

    An intermediate solution is to manually load the xls-toolbox (addtoolbox(‘omlxlstoolbox’)) in oml command window or model context.