Srishti Saha
Whitefield
Followers: 0 Following: 0
A data scientist by profession, electronic engineer by education and a coder by the hobby
統計
All
Feeds
回答済み
Write a function called digit_counter that takes the name of a text file as input and returns the number of digits (i.e., any of the characters, 0-to-9) that the file contains. If there is a problem opening the file, the function returns -1
A simple function as this would work: function n = digit_counter(fname) n = -1; fid = fopen(fname,'r');...
Write a function called digit_counter that takes the name of a text file as input and returns the number of digits (i.e., any of the characters, 0-to-9) that the file contains. If there is a problem opening the file, the function returns -1
A simple function as this would work: function n = digit_counter(fname) n = -1; fid = fopen(fname,'r');...
6年以上 前 | 0
回答済み
Number of first days of the month equals to Mondays
I have written the following function and it has worked perfectly for me: %problem day counterfunction n = day_counter(year...
Number of first days of the month equals to Mondays
I have written the following function and it has worked perfectly for me: %problem day counterfunction n = day_counter(year...
6年以上 前 | 1
回答済み
How can I correct this error?
This works perfectly: %problem huge add function summa = huge_add(a,b) if ~ischar(a) || ~ischar(b) || sum(isstrprop(a...
How can I correct this error?
This works perfectly: %problem huge add function summa = huge_add(a,b) if ~ischar(a) || ~ischar(b) || sum(isstrprop(a...
6年以上 前 | 1
回答済み
Write a function called smallest_multiple
Here is a solution that worked for me: %%alternative solution to smallest multiple function r = smallest_multiple(k) ...
Write a function called smallest_multiple
Here is a solution that worked for me: %%alternative solution to smallest multiple function r = smallest_multiple(k) ...
6年以上 前 | 1
回答済み
Cant seem to find the error in the question, please help
This function worked perfectly for me: function mbd = spherical_mirror_aberr( fn,D ) f=fn*D; delta_x = 0.01; x...
Cant seem to find the error in the question, please help
This function worked perfectly for me: function mbd = spherical_mirror_aberr( fn,D ) f=fn*D; delta_x = 0.01; x...
6年以上 前 | 0
質問
How do I vectorize each digit of an integer and store it as an array?
I have to convert an integer into a vector of all its digits. Example: 100---> [1 0 0] function ans = int2vec(x) t=regexp...
6年以上 前 | 2 件の回答 | 0
2
回答質問
How can I take variable number of input strings in a function and return the concatenated output string?
I have to write a function that takes variable number of inputs (even no input is allowed) and returns a concatenate string as t...
6年以上 前 | 1 件の回答 | 0
1
回答回答済み
Can anyone find the error in my code?
Hey, this piece of code works just fine: %function to compute euler's number function [approx_e, k] = approximate_e (delt...
Can anyone find the error in my code?
Hey, this piece of code works just fine: %function to compute euler's number function [approx_e, k] = approximate_e (delt...
6年以上 前 | 0
回答済み
Write a function called approximate_e that uses the following formula to compute e, Euler’s number: = 1 ! ∞ = 1+1+ 1 2 + 1 6 + 1 24 +⋯ Instead of going to infinity, the function stops at the smallest k for which the approximation differs from
Tested this: %function to compute euler's number function [approx_e, k] = approximate_e (delta) % Set the variables for t...
Write a function called approximate_e that uses the following formula to compute e, Euler’s number: = 1 ! ∞ = 1+1+ 1 2 + 1 6 + 1 24 +⋯ Instead of going to infinity, the function stops at the smallest k for which the approximation differs from
Tested this: %function to compute euler's number function [approx_e, k] = approximate_e (delta) % Set the variables for t...
6年以上 前 | 1
回答済み
how do I remove special characters from my cell array strings?
This worked for me s_nos=regexprep(s_split,'[^0-9]','');
how do I remove special characters from my cell array strings?
This worked for me s_nos=regexprep(s_split,'[^0-9]','');
6年以上 前 | 0
| 採用済み
回答済み
Write a function called halfsum that takes as input an at most two-dimensional matrix A and computes the sum of the elements of A that are in the diagonal or are to the right of it. example, the input is [1 2 3; 4 5 6; 7 8 9],the ans is 26
This code works perfectly for me: %function to compute sum of lower most right side triangle in an X*2 matrix function u =...
Write a function called halfsum that takes as input an at most two-dimensional matrix A and computes the sum of the elements of A that are in the diagonal or are to the right of it. example, the input is [1 2 3; 4 5 6; 7 8 9],the ans is 26
This code works perfectly for me: %function to compute sum of lower most right side triangle in an X*2 matrix function u =...
6年以上 前 | 0
回答済み
How to do it?
This code works perfectly for me: %function to compute sum of lower most right side triangle in an X*2 matrix function u =...
How to do it?
This code works perfectly for me: %function to compute sum of lower most right side triangle in an X*2 matrix function u =...
6年以上 前 | 0
質問
how do I remove special characters from my cell array strings?
I have a cell array of the sorts: {'508-647-7000'} {' (508) 647-7001'} {' 617-555-1212'} I need the special charac...
6年以上 前 | 1 件の回答 | 0
1
回答回答済み
Compute the product of the next n elements in matrix
This should work. has been tested and refined: function B = maxproduct(A,n) % After checking that we do not have to retu...
Compute the product of the next n elements in matrix
This should work. has been tested and refined: function B = maxproduct(A,n) % After checking that we do not have to retu...
6年以上 前 | 1
回答済み
How can I solve this problem?
This should work perfectly: function mul = smallest_multiple(n) facts = zeros(1,n); % store the exponents ...
How can I solve this problem?
This should work perfectly: function mul = smallest_multiple(n) facts = zeros(1,n); % store the exponents ...
6年以上 前 | 2
回答済み
Write a function called digit_counter that takes the name of a text file as input and returns the number of digits (i.e., any of the characters, 0-to-9) that the file contains. If there is a problem opening the file, the function returns -1.
This should definitely work: %function: digit_counter in a file; takes file name as argument function dc = digit_counter(f...
Write a function called digit_counter that takes the name of a text file as input and returns the number of digits (i.e., any of the characters, 0-to-9) that the file contains. If there is a problem opening the file, the function returns -1.
This should definitely work: %function: digit_counter in a file; takes file name as argument function dc = digit_counter(f...
6年以上 前 | 0
回答済み
Hey Guys can you help me with that.
I think this is the most elegant solution that takes care of all exceptions. Apologies if it has been covered in the past: ...
Hey Guys can you help me with that.
I think this is the most elegant solution that takes care of all exceptions. Apologies if it has been covered in the past: ...
6年以上 前 | 1