Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

Read from Excel file

0 votes
648 views
Hello All,

I am trying to read simulation parameters from an excel sheet, where i would like to create multiple simulation configurations as separate sheets.

in this example I have an excel sheet with the following data

VariableName     Value  Unit
Mass                   1500   Kg
TireDiameter       1         m

The following matlab script executes successfully in matlab, but when I run it as an initialization command in Plecs it gives an error 'xlsread' undefined.

[A,T] = xlsread('TestTable.xlsx','sheet1','A2:B3');
for i = 1:length(A)
    assignin('base',T{i},A(i))
end

is it possible to read an excel sheet data in Plecs scripts? and is there a list of supported matlab commands?
asked Sep 28, 2020 by abugabma (16 points)

1 Answer

0 votes
Hello,

PLECS Standalone doesn't actually use MATLAB commands, but rather Octave commands. It's true that most of the syntax and commands are the same between the two languages, but you should always refer to Octave documentation in this case. Have you tried the csvread() function for this purpose?

Technically if you browse the PLECS installation folder contents you can find a folder inside .../octave/share/version/m/ that contains various function files, but this should only be used to verify if a function is available in the Octave distribution included with PLECS.

Best regards,

Kris
answered Sep 29, 2020 by Kris Eberle (1,575 points)
...