필터 지우기
필터 지우기

i have excel sheet 31 coulmn,, the first coulmn is time and in the other coulmns the signals names , what i need from the code is that at spefic time to tell me for examplk

조회 수: 2 (최근 30일)
i have excel sheet 31 coulmn,, the first coulmn is time and in the other coulmns the signals names , what i need from the code is that at spefic time to tell me for example how many ones are there and which samples of the 31 are the one at that time , how to that ?
  댓글 수: 4
Walter Roberson
Walter Roberson 2022년 12월 7일
Are the entries in the first column integers that represent nanoseconds ? You write 5.00ns but that implies potential problems if the file has 4.9995 ns or the user asks for 6 ns when you only have times in 5 ns increments (for example)
Hagar Hendy
Hagar Hendy 2022년 12월 7일
i get that table from another program , and i know the at which time the signal is one, so acording to that , i am choosing that spesfic time, , my concerns is how to know that this signal is one , not only the counting , i want to know the signal name that is 1 out of the 30

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2022년 12월 7일
편집: Walter Roberson 2022년 12월 7일
Given a particular scalar row index (calculated from the time, perhaps):
VarNames = YourTable.Properties.VariableNames;
ValuesAtIndex = YourTable{RowIndex, 2:end};
match_columns = 1 + find(ValuesAtIndex == 1);
matched_signal_names = VarNames(match_columns);
matched_signal_names will be a cell array of character vectors. It will be empty if there are no matches, and might have multiple entries if there are multiple matches.
  댓글 수: 3
Walter Roberson
Walter Roberson 2022년 12월 7일
"i have excel sheet 31 coulmn"
You cannot use load() to load a .xls or .xlsx -- it will complain about the file being in an unknown format.
You can use load() to load a .csv file only if the .csv file is pure numeric, or pure numeric with comma delimiter, or if all lines that have text begin with % in the very first column.
If you have a .csv file that has a text header that does not happen to have % as the very first character, you cannot use load() to read the file.
To read a .csv file, you need to use one of readtable (if it has entries that are not pure numbers), or readmatrix (entries other than the headers must be pure numbers), or dlmread or csvread specifying the number of headerlines; or using one of the lower-level routines such as fopen + textscan
Peter Perkins
Peter Perkins 2022년 12월 12일
In recent versions, if time is involved, use readtimetable. Then use time subscripting on the timetable, and beyond that, I can't tell what the question is.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by