MatLab does not reads Excel sheet properly

3 visualizzazioni (ultimi 30 giorni)
status = mkdir('D:\PK90'); cd D:\PK90
filename = 'sample111.xlsx'; T = readtable(filename);
P = 2*T.A + 3*T.B + 4*T.C + 5*T.D + 6*T.E
%% When running the Excel sheet, I want MatLab to read the values of all the parameters as varies in the sheet downward. When one parameter varies other values will be considered from first row.
  4 Commenti
MINATI PATRA
MINATI PATRA il 13 Feb 2024
Spostato: Cris LaPierre il 13 Feb 2024
Sorry for the inconvinience.
Here is the excel sheet attached.
I want to run the code with variations of different parameters BUT when suppose I take values of 'A' as 2, 3 , values of other parameters are the default values (GREEN color, FIRST line values)
MINATI PATRA
MINATI PATRA il 13 Feb 2024
@
Dyuman
The sheet is in C: drive where MatLab is present, then result will be created in D:drive.
Actually this is part of the full code.

Accedi per commentare.

Risposta accettata

Cris LaPierre
Cris LaPierre il 13 Feb 2024
Spostato: Cris LaPierre il 13 Feb 2024
readtable just loads the data as is. You will still need to write code to perform any manipulation to the data. Perhaps fillmissing does what you want?
d=readtable("sample111.xlsx")
d = 12×5 table
A B C D E ___ ___ ___ ___ ___ 1 2 0.5 0.1 0.1 2 NaN NaN NaN NaN 3 NaN NaN NaN NaN 1 1 NaN NaN NaN NaN 3 NaN NaN NaN NaN 2 0 NaN NaN NaN NaN 1 NaN NaN NaN NaN 0.5 0.3 NaN NaN NaN NaN 0.5 NaN NaN NaN NaN 0.1 0.3 NaN NaN NaN NaN 0.5 NaN NaN NaN NaN 0.1
% replace NaNs with previous value
d = fillmissing(d,"previous")
d = 12×5 table
A B C D E _ _ ___ ___ ___ 1 2 0.5 0.1 0.1 2 2 0.5 0.1 0.1 3 2 0.5 0.1 0.1 1 1 0.5 0.1 0.1 1 3 0.5 0.1 0.1 1 2 0 0.1 0.1 1 2 1 0.1 0.1 1 2 0.5 0.3 0.1 1 2 0.5 0.5 0.1 1 2 0.5 0.1 0.3 1 2 0.5 0.1 0.5 1 2 0.5 0.1 0.1

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by