display into array with bracket

My script gives output values in the below format;
Time = 68535763846
Time = 6538764367
Time= 536743643
But I want to display these values in the form of
Time = [68535763846, 6538764367, 536743643]
Any help will be appreciated.

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 7 月 28 日
編集済み: Azzi Abdelmalek 2014 年 7 月 28 日

0 投票

Time = [68535763846, 6538764367, 536743643]
out=['[' num2str(Time) ']']
%or
Time = [68535763846, 6538764367, 536743643]
out=['[' sprintf(' %d, ', Time(1:end-1) ) num2str(Time(end)) ']']

カテゴリ

ヘルプ センター および File ExchangeResizing and Reshaping Matrices についてさらに検索

質問済み:

2014 年 7 月 28 日

編集済み:

2014 年 7 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by