[繪圖] surf繪圖

作者: GTR9111007 (人不仆街枉少年)   2017-06-21 09:41:09
各位大大好,小弟是把一個text檔讀進來,把一行一行的數字收集完,
形成一個矩陣後再畫出來,所以會邊讀邊畫,直到檔案讀完為止。
但畫出的圖沒有跟著colorbar顏色改變,不知道還要設定什麼?
http://imgur.com/wrIlWbx
以下是我的source code,只貼畫圖的部分:
figure(1);
h = surf(Data);
colormap jet;
colorbar;
caxis([LowBound UpBound]) ;
axis([1 RxNum 1 TxNum LowBound UpBound]);
while (!feof(fid))
Textline = fgetl(fid);
# Begin to get Data 
if(strncmp(Textline, "Frame", 5))
ParsingOn = 1;
continue;
endif
if(ParsingOn==1)
Textline = str2num(Textline);
Data(Cnt,:) = Textline;
Cnt++;
if(Cnt==TxNum+1)
set(h, 'ZData', Data); % 設定新的 z 座標
drawnow;
Data = [];
ParsingOn = 0;
Cnt = 1;
endif
endif
endwhile

Links booklink

Contact Us: admin [ a t ] ucptt.com