Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7603403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:38:51+00:00 2026-05-30T23:38:51+00:00

When I am accessing the structure fields like s(1).’fieldname’ it’s coming back empty. Only

  • 0

When I am accessing the structure fields like s(1).’fieldname’ it’s coming back empty. Only the last value can be seen, i.e s(97).’fieldname’. This is my code:

clc;
clear all;
data1= load('mydata.txt');
a=1;n=1;count=1;m=0;
while (count<98)                           % main loop starts
    for i=a:a+1023
        mydata1(i-m*1024)=data1(i);        % taking 1k points in mydata1
    end
    m=m+1;
    newdata=10*log10(abs(fft(mydata1)));   % taking fft in newdata from mydata
    for j=1:512
        newdata1(2*j-1)=newdata(j);        % interpolation of newdata to newdata1
        newdata1(2*j)=newdata(j);          % newdata1 size is 1024
    end
    a=j*n+513;
    n=2*count+1;
%     plot(newdata1);
%     pause(1);                            % setting threshold
    th=18;
    newdata2(newdata1<th)=0;               % newdata2 has 1024 0s and many 1s 
    newdata2(newdata1>=th)=1;
    num=0;
    for k=1:1023                           % loop for reducing many 1s
        if((newdata2(k)==1)&&(newdata2(k+1)==1))
        num=num+1;
        end
        if(num>0 && (newdata2(k+1)==0 || k==1023))
            for p = k-num:k
                newdata2(p)=0;
            end
            p= (k-num)+floor(num/2);
            newdata2(p)=1;
            num=0;
        end                                % loop ends
   end
   newdata2(1024)=0;                       % newdata2 with only 1s and 0s
   binnum = find(newdata2);
   x=length(binnum);
   frequency=((100000/1024)*binnum);
   for y=1:x
       strength(y)=(newdata1(binnum(y)));
   end
   s= struct;                              % writing into a structure
   s(count).frame=count;
   s(count).freq=frequency;
   s(count).str=strength;
   count=count+1;
end  

Where am I going wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T23:38:52+00:00Added an answer on May 30, 2026 at 11:38 pm

    The line s= struct; %writing into a structure is creating a new structure variable each iteration of the while loop. Either move this line outside the loop, or omit it completely.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can accessing (for read only) memory freed cause an access violation, and, if so,
I have this folder structure: /www/project/web/app.php I can access it via /project/web/index.php . The
I'm searching for a high accessing logging solution. My table has this structure: |
folks, I have the directory structure like this: webapps |-- static_media |-- django |---project
I am having trouble in accessing an array within a structure. How can I
The file structure looks like this root root/x root/x/y.php root/index.php .htaccess code RewriteRule (.*)
While accessing a webservice which is availbale at http://recpushdata.cyndigo.com/jobs.asmx , I am getting this
I am having problems with accessing individual structure elemnsts. How to output each structure
Say I have a directory structure like so: /public /public/company /public/globals /public/globals/images /public/jobs /public/jobs/it
I am writing an internal DSL in Ruby. Currently, the basic structure in this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.