Read from Excel file

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?

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