Solved

Upscale integer array

Posted on 2013-05-23
1
318 Views
Last Modified: 2016-09-30
Hello,
  I have some acquisition data stared in the following  arrays:

const
cChannels = 6;
cMaxSampleDuration = 420;

var
    MyIntegerArray: array[0..cChannels -1, 0..cMaxSampleDuration -1] of Integer;

Sample Data
As you can see from the screenshot, the first channel has range -4.000 up to 4.000 and the other have smaller range. how can upscale the other channels to be almost in equal range of the first channel ?

Thank you
0
Comment
Question by:chmichael
1 Comment
 
LVL 26

Accepted Solution

by:
Sinisa Vuk earned 500 total points
ID: 39192655
Is this similar question as you asked before? Do you have problem with my code?
http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_28126546.html

For this request - little modification:
var
  MyIntegerArray: array[0..cChannels -1, 0..cMaxSampleDuration -1] of Integer;
  MaxVal, Channel, Samples, MaxAmp: Integer;
...
  MaxAmp := 4000;

  for Channel := 0 to 6 -1 do
  begin
    //pre scale to get max
    MaxVal := 0;
    for Samples := 0 to cMaxSampleDuration -1 do
      if Abs(MyIntegerArray[Channel, Samples])>MaxVal then MaxVal:=Abs(MyIntegerArray[Channel, Samples]);

    //scaling
    for Samples := 0 to cMaxSampleDuration -1 do
      MyIntegerArray[Channel, Samples] := MulDiv(MyIntegerArray[Channel, Samples], MaxAmp, MaxVal);
  end;

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now