Loading a file into MATLAB as it is? [closed] - matlab

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm working on a telecommunications device simulator on MATLAB. I'm going to encode some digital data, modulate it, add some noise and attempt to demodulate it, see at what noise levels my data cannot be recovered anymore.
My problem is, I don't know how to import some crazy file to my workspace. It's not going to be txt or anything, just some file. How can I make MATLAB read the file in binary format or whatever it is called?

Try questions regarding to work with binary data in matlab
Working on Binary Data in Matlab
Read and write from/to a binary file in Matlab

Can you be more specific ??? Instead of specifying whatever format you could actually look at the extension and specify the extension.If it is a video then you can read it with mmreader(),if it is an image then you read it with imread().So please specify the extension of the file which you want to load into MATLAB.
H2H
-Harsha

It turns out I was using the right function with wrong parameters all along. I opened the file I wanted to open with fopen('filename') and used the number that function outputs in A=fread(thenumber). That returned an array of each and every byte in the file by their decimal values. I'm sure I'll be able to use this data for my project.
Thanks to everybody for their help!

Related

How much time it takes to insert bulk mount of data into CoreData [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
In my application i am downloading thousands of records, and i have to inert them in to CoreData.
I have to estimate the time to download and process the data.
Downloading time depends on the user's interned speed.
Can you please tell me how much time it takes to insert 10000 records in CoreData?
Thanks,
Jack.
You are asking several questions in one and they have been answered already. Let me wrap it all up and give you further information regarding your question.
Time of bulk inserts: Depends on the kind of data and on the computation power / hard disk of your device. It also depends on how you actually perform the bulk insert.
Improve Performance if needed: There are many things you can do to increase the performance. If you encounter performance problems when inserting objects in bulk please have a look at the following post on Stackoverflow: Improving Performance of Bulk Inserts. There is also a chapter in the Core Data Programming guide which is called Efficiently Importing Data which you should read. Core Data Programming Guide: Efficiently Importing Data
Estimating remaining time of the download: A naive calculation of the time remaining would only take the current speed and the number of remaining bytes to download in consideration. This is usually a very bad estimation which jumps around a lot. In order to smooth the estimation you should use a Moving Average. A moving average takes previous values in consideration. An algorithm which makes use of a moving average to estimate the remaining time can be found on Stackoverflow as well.
Why don't you check yourself by inserting NSLog-commands after the download is finished and another one after the CoreData operation is finished?
The consol will give you exact timestamps of the start/end of the operations.
Like David Rönnqvist said before: In most cases downloading takes way longer than inserting items into the database.

How to name my averaging technique? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Suppose, I have a list of values {4, 10, 3, 6, 7, 15, 11}. The average of this number list is avg=8. Now I will select only those elements > avg, which are {10, 11, 15}. Now I am doing average again and selecting the elements bigger than their average. I believe this a helpful technique to get the top rated values from a list, I am not sure about the naming of this averaging technique. Can anybody help me with some name of this method?
Thanks in advance
How about using Averoveraging?
I'm not sure what your code looks like, but I'd imagine on one pass you are returning elements higher than the average? So I would name that method ElementsGreaterThanAverage.
If you're only always doing two passes, you could call it TopQuarterByAveraging or something.
You're computing the mean, then showing everything over it. Hence OverMean.

Why languages do not allow multiple return values? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
In languages like C which supports pointer operation, you can easily get multiple values from a procedure. But in languages like Java, it is a pain if you actually need to get multiple return values. (Using an object to wrap multiple values is bad)
In my experience, allowing multiple values returned can help improve software engineering--more flexible to organise procedure invocation, etc. But why there are so many languages that do no allow returning multiple values? I am interested to know the reasons. Thank you very much.
Could be because many of the designers of these languages have strong math backgrounds and in math a function can have multiple input parameters but (almost always) only a single output value.
Also, it keeps code understandable and standardized to some extent.

Matlab code formatting similar to AStyle? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Is there any tool similar to AStyle to format matlab code in m-files?
In recent versions of MATLAB, you can use the "Smart Indent" tool programmatically using the MATLAB Editor API.
As an example, say you want to fix indentation of all M-files contained in a specific directory:
%# gel list of m-files in a directory
BASE_DIR = 'c:\path\to\folder';
files = dir( fullfile(BASE_DIR,'*.m') );
files = {files.name};
for i=1:numel(files)
%# open file in editor, apply smart indentation, save and close
doc = matlab.desktop.editor.openDocument( fullfile(BASE_DIR,files{i}) );
doc.smartIndentContents;
doc.save;
doc.close;
end
Remember that you can select text in Matlab's editor and press Ctrl+I to auto-indent it. (Also , use Ctrl+A to select all the text.)

How do I write a generic function that takes a Number or some alphabets and display that in 7- bit segment display.? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I want to write a Digital Clock application in which I have a 7- bit segment display. I want to write a generic code for displaying all the input. I have a CGPath in which I have 1 line for each segment.
Now, how would I write a generic function for the above description?
Any help with some logic or code will be appreciated.
Thanks
Simplest would be a look-up table. You could do it with ten bytes. Assign one bit in the bytes to each segment. Pre-load the table with the hex values necessary to set the bits. Index the table with your digit 0-9. If you want to have additional combinations of segments then make the table larger -- typically these are set up to display an additional 6 "characters" (eg, A, b, C, d, E, and F), making the table conveniently 16 long.
But, for extra credit, do it with NAND gates.