MATLAB TO C conversion
[rawdata , count] = fread(fid_rawdatafile, numofdatapointstoberead , 'uint8');
I'm working on matlab and i'm not able to understand what this means!
 What does this command do?
 How can I rewrite this in C language?
See also questions close to this topic

Warning : assignment from incompatible pointer type when using pointers and linked lists?
I'm getting this warning (Warning : assignment from incompatible pointer type) while trying to make a linked list that goes like this:
typedef struct { int data; struct Element *Next;}Element; main (){ Element *start = NULL; Elemento *end=NULL; Element *new_element; if ((new_element = (Element *) malloc (sizeof (Element))) == NULL) exit (1); new_element>data=10; new_element>Next = &start; start = new_element; return 0;}
and the warning comes on this line:
new_element>Next = start;

Generate a Secret Number and Guess it in C
So a little background, I have to create a program in which you generate a secret number, the user has to input a three digit number as a guess and the program should print hints along the way. Hints are print "fermi" if you have a digit in the correct place, print "pico" if you have a correct digit but not in the correct place and then print "bagels" if nothing matches. The issue I'm having is I keep getting an error or a warning message "makes integer from pointer without a cast" i assume I'm not passing pointers correctly into my function, so if anyone could help me out that would be greatly appreciated, thank you!
int main() { setvbuf(stdout, NULL, _IONBF, 0); srand((int)time(NULL)); play_game(); } void play_game() { int *num1 = 0; int *num2 = 0; int *num3 = 0; int guess,first,second,third, x; theSame(&num1, &num2, &num3); do { printf("\nPlease enter a three digit number as your guess or enter 0 to exit: "); x = scanf("%d", &guess); if(!x == 0) { first = guess/ 100; second = (guess%100) /10; third = guess %10; printf("Guess: %d, ", guess); print_hint(guess, num1,num2,num3); is_guess_correct(guess, num1, num2, num3); } } while((!x == 0)); } void generate_secret_number(int *a, int *b, int *c) { *a = (rand() % 9) + 1; *b = (rand() % 10); *c = (rand() % 10); } int is_guess_correct(int guess, int a, int b, int c) { int first, second, third; first = guess/ 100; second = (guess%100) /10; third = guess %10; if(first == a && second == b && third == c) { return 1; } else { return 0; } } void print_hint(int guess, int a, int b, int c) { int first, second, third; first = guess/ 100; second = (guess%100) /10; third = guess %10; if(a == first  b == second  c == third) { printf("Fermi, "); } if(first == b  first == c  second == a  second == c  third == a  third == b) { printf("Pico, "); } if(a == first && b == second && c == third) { printf("Winner !!"); } else if(a != first && b != second && c!= third) { printf("Bagels"); } } void theSame(int *a, int *b, int *c) { generate_secret_number(a,b,c); while(*a == *b  *b == *c  *c == *a) { if(*a == *b) { *a = (rand() % 8) + 1; } if(*b == *c) { *b = (rand() % 9); } if(*a == *c) { *c = (rand() % 9); } } printf("\nsecret number: %d%d%d", *a,*b,*c); }

segmentation fault (core dumped) error when compiling this code in c
When I compile this code I get an error"segmentation fault(core dumped)". I see that the error lies in " printf("%c", first(s));", it seems that it is not the correct way to pass char/string to function? if not then what is the problem with my code?
#include <stdio.h> char first(char *str); char first(char *str){ int L=0; int a[127]={0}; for (int i=0; i<127; i++){ a[i]=i+1; } while (str!= '\0'){ for(int d=1; d<127; d++){ if(str[L]==(char)d){ if (a[L]>0){ a[L]=0; L++; break; } else if(a[L]==0){ a[L]=1; L++; break; } else{ L++; break; } } } } for(int i=0; i>127; i++){ if(a[i]==0) return (char)(i+1); } return '\0'; } int main() { char s="blazqnqbla"; printf("%c", first(s)); return 0; }

Matlab code generation of resample: the number of terms N must be constant
I use Matlab coder to generate C code of the following function:
function [out] = myresample(in) out = resample(in,4644,1000,10); end
and generate the code by
codegen myresample args {coder.typeof(0, [1 Inf]), 0} config cfg
, wherecfg = coder.config('lib')
,cfg.DynamicMemoryAllocation = 'AllVariableSizeArrays'
.But it reports the error as:
??? The number of terms N must be constant.
I am confused why it is wrong. Interestingly, when I change the function to
function [out] = myresample(in) out = resample(in,10,10,10); end
it works.
I have found some links explaining how to generate code of
resample
. But it seems not work for my case.I use Matlab 2017b.
Thanks.

Faster version of matlab's besselj function?
I have code that is computing besselJ function multiple times and I was wondering if there was a function/implementation of the Bessel Function of the first kind order 0, 1, 2, ... so on that was faster.
I know there are built in functions in scipy that do this (scipy.special.j0), but does Matlab have this as well? So far I have not been able to find anything about it.

Running 3 independent for loops in parallel in Matlab
I have three mobile operators O1,O2, and O3, each of them has its own mobile ( N_M_O1,N_M_O2, and N_M_O3) they are sharing the base stations (B1 and B2) represented by (conter_B1,conter_B2) I am coding this situation as:
N_M_O1=10; N_M_O2=12; N_M_O3=13; conter_B1=0; conter_B2=0; x=[2 3 5 8 6 3 4 5 8 9]; y=[2 3 6 5 2 9 4 6 3 5]; x2=[2 8 5 8 6 3 6 5 6 9 10 12]; y2=[9 3 6 9 7 9 4 6 8 5 1 23]; x3=[2 3 1 8 6 3 55 5 6 9 2 3 5]; y3=[2 4 6 4 6 5 4 6 6 4 12 32 3]; for m=1:N_M_O1 z(m)=x(m)+y(m); if z(m)>10 conter_B1=conter_B1+1; else conter_B2=conter_B2+1; end end for m=1:N_M_O2 z2(m)=x2(m)+y2(m); if z2(m)>10 conter_B1=conter_B1+1; else conter_B2=conter_B2+1; end end for m=1:N_M_O3 z3(m)=x3(m)+y3(m); if z3(m)>10 conter_B1=conter_B1+1; else conter_B2=conter_B2+1; end end
I need to run these independent loops at the same time for example it must took the first value of N_M_O1,N_M_O2,N_M_O3 as the first loop, the second loop, and the third loop respectively at the same time and increment the conter_B1,conter_B2 at the same time if match the condition
NOTE: I tried with parfor command but I am confuse how can code it