Easy way to divide a field in a struct by a number?
조회 수: 11 (최근 30일)
이전 댓글 표시
Hello All,
I have a 5394 x 1 struct with 2 fields labeled "cluster" and "spx_time". I'd like to divide all values in the "spx_time" field by 1000. Is there an easier way to do this other than by using a for loop?
Thanks!
댓글 수: 0
채택된 답변
Image Analyst
2018년 7월 16일
If you want to extract them into a double variable you can avoid a for loop (though one might be done internally with []):
new_spx_times = [s.spx_time] / 1000;
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Identification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!