very basic matlab question about .dat file
5 次查看(过去 30 天)
显示 更早的评论
I'm doing an assignment for a programming class I'm in, and it is asking me to write a .dat file measuring two variables (i.e. wind speed & visibility) over a 24 hr period. I assumed it would require a matrix to do this, but I am having trouble creating the matrix to measure two variables. It's probably a very simple answer but I've been trying to figure it out for a while. Please let me know if you have any tips on this
0 个评论
采纳的回答
Matt Tearle
2011-9-29
The statement of the problem seems ill-formed to me. How are these variables being "measured"? I could see reading in from a file of measurements. I could see calculating two variables from something else then writing out to a file. But I'm confused by the question as stated.
General thoughts: typically the two variables would be vectors (one element per measurement). You can concatenate vectors together into a matrix using array concatenation: [a,b]. You can write matrix data out to a file using sprintf.
0 个评论
更多回答(1 个)
Tim
2011-9-29
Hi Arielle,
Are you reading from a file? If so you can use the import wizard found under the file menu. Or you can use dlmread
wind = dlmread('windData.dat')
type help dlmread for further examples. You might need to add more depending on how your data is delimited.
Tim
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!